ICoreWindow ICoreWindow ICoreWindow ICoreWindow Interface

Definition

Specifies an interface for a window object and its input events as well as basic user interface behaviors.

public : interface ICoreWindow
struct winrt::Windows::UI::Core::ICoreWindow
public interface ICoreWindow
Public Interface ICoreWindow
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

AutomationHostProvider AutomationHostProvider AutomationHostProvider AutomationHostProvider

Specifies the property that gets the automation provider assigned to this window.

public : Platform::Object AutomationHostProvider { get; }
winrt::Windows::Foundation::IInspectable AutomationHostProvider();
public object AutomationHostProvider { get; }
Public ReadOnly Property AutomationHostProvider As object
Value
object object

The automation provider for this window.

Bounds Bounds Bounds Bounds

Specifies the property that gets the bounding rectangle of the window.

public : Rect Bounds { get; }
Rect Bounds();
public Rect Bounds { get; }
Public ReadOnly Property Bounds As Rect
Value
Rect Rect

The bounding rectangle of the window, in device-independent pixel (DIP).

Remarks

To convert from device-independent pixel (DIP) to physical pixels (and back), use the following equations (where DPI is the dots per inch value for the screen):

  • DIP value = (physical pixel x 96) / DPI
  • physical pixel value = (DIP x DPI) / 96
See Also

CustomProperties CustomProperties CustomProperties CustomProperties

Specifies a property that gets the set of custom properties for the window.

public : IPropertySet CustomProperties { get; }
IPropertySet CustomProperties();
public IPropertySet CustomProperties { get; }
Public ReadOnly Property CustomProperties As IPropertySet
Value
IPropertySet IPropertySet

The set of custom properties for the window, represented as tuples.

See Also

Dispatcher Dispatcher Dispatcher Dispatcher

Specifies a property that gets the event dispatcher for the window.

public : CoreDispatcher Dispatcher { get; }
CoreDispatcher Dispatcher();
public CoreDispatcher Dispatcher { get; }
Public ReadOnly Property Dispatcher As CoreDispatcher
Value
CoreDispatcher CoreDispatcher

The event dispatcher for the window.

See Also

FlowDirection FlowDirection FlowDirection FlowDirection

Specifies the property that gets or sets the horizontal origin of the window's reading order alignment. If the language specified by the user interface is right-aligned (such as in Arabic or Hebrew), the horizontal origin of the reading layout for the window is on the right edge.

public : CoreWindowFlowDirection FlowDirection { get; set; }
CoreWindowFlowDirection FlowDirection(); void FlowDirection(CoreWindowFlowDirection flowdirection);
public CoreWindowFlowDirection FlowDirection { get; set; }
Public ReadWrite Property FlowDirection As CoreWindowFlowDirection
Value
CoreWindowFlowDirection CoreWindowFlowDirection

The flow direction of the window's reading layout.

See Also

IsInputEnabled IsInputEnabled IsInputEnabled IsInputEnabled

Specifies a property that gets or sets whether input is enabled for the window.

public : Platform::Boolean IsInputEnabled { get; set; }
bool IsInputEnabled(); void IsInputEnabled(bool isinputenabled);
public bool IsInputEnabled { get; set; }
Public ReadWrite Property IsInputEnabled As bool
Value
bool bool

True if input is enabled for the window; false if it is disabled.

PointerCursor PointerCursor PointerCursor PointerCursor

Specifies a property that gets or sets the cursor used by the window.

public : CoreCursor PointerCursor { get; set; }
CoreCursor PointerCursor(); void PointerCursor(CoreCursor pointercursor);
public CoreCursor PointerCursor { get; set; }
Public ReadWrite Property PointerCursor As CoreCursor
Value
CoreCursor CoreCursor

The window's cursor.

PointerPosition PointerPosition PointerPosition PointerPosition

Specifies a property that gets the position of the pointer.

public : Point PointerPosition { get; }
Point PointerPosition();
public Point PointerPosition { get; }
Public ReadOnly Property PointerPosition As Point
Value
Point Point

The current position of the cursor in device-independent pixels (DIPs).

Visible Visible Visible Visible

Specifies the property that gets whether the window is visible or not.

public : Platform::Boolean Visible { get; }
bool Visible();
public bool Visible { get; }
Public ReadOnly Property Visible As bool
Value
bool bool

True if the window is visible on the screen; false if it is not.

Methods

Activate() Activate() Activate() Activate()

Specifies a method that activates the window. This method is called to present the window on the screen.

public : void Activate()
void Activate() const;
public void Activate()
Public Function Activate() As void

Remarks

The window will be presented if the app is the foreground window. If the app has more than one window, the activating window will be presented when the app is set to the foreground.

Close() Close() Close() Close()

Specifies the method that closes the window and exits the message loop.

public : void Close()
void Close() const;
public void Close()
Public Function Close() As void

Remarks

This method also causes the ProcessEvents operation to exit the event processing loop.

GetAsyncKeyState(VirtualKey) GetAsyncKeyState(VirtualKey) GetAsyncKeyState(VirtualKey) GetAsyncKeyState(VirtualKey)

Specifies a method that returns the state of a virtual key asynchronously.

public : CoreVirtualKeyStates GetAsyncKeyState(VirtualKey virtualKey)
CoreVirtualKeyStates GetAsyncKeyState(VirtualKey virtualKey) const;
public CoreVirtualKeyStates GetAsyncKeyState(VirtualKey virtualKey)
Public Function GetAsyncKeyState(virtualKey As VirtualKey) As CoreVirtualKeyStates
Parameters
virtualKey
VirtualKey VirtualKey

The virtual key for which state will be returned.

Returns

The state of the supplied virtual key when the input event was raised.

GetKeyState(VirtualKey) GetKeyState(VirtualKey) GetKeyState(VirtualKey) GetKeyState(VirtualKey)

Specifies a method that gets the state of a key.

public : CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey)
CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey) const;
public CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey)
Public Function GetKeyState(virtualKey As VirtualKey) As CoreVirtualKeyStates
Parameters
virtualKey
VirtualKey VirtualKey

The virtual key for which state will be returned.

Returns

The state of the supplied virtual key when the input event was raised.

See Also

ReleasePointerCapture() ReleasePointerCapture() ReleasePointerCapture() ReleasePointerCapture()

Specifies a method that dissociates pointer input from the app, if previously associated through SetPointerCapture, and restores normal pointer input processing.

public : void ReleasePointerCapture()
void ReleasePointerCapture() const;
public void ReleasePointerCapture()
Public Function ReleasePointerCapture() As void

SetPointerCapture() SetPointerCapture() SetPointerCapture() SetPointerCapture()

Specifies a method that associates pointer input with the app. Once a pointer is captured, all subsequent events associated with that pointer are fired by the app.

A pointer can be captured only by a single app at any time.

Pointer events continue even if the pointer moves outside the bounds of the app.

public : void SetPointerCapture()
void SetPointerCapture() const;
public void SetPointerCapture()
Public Function SetPointerCapture() As void

Remarks

Only the foreground window can capture the pointer.

A pointer can only be captured when contact is detected (mouse button pressed, touch contact down, stylus in contact), and the pointer is within the bounding rectangle of the app.

The pointer is released on a PointerReleased or a PointerCaptureLost event, or ReleasePointerCapture is explicitly called.

Events

Activated Activated Activated Activated

Specifies the event that is fired when the window completes activation or deactivation.

public : event TypedEventHandler Activated<CoreWindow, WindowActivatedEventArgs>
// Register
event_token Activated(TypedEventHandler<CoreWindow, WindowActivatedEventArgs> const& handler) const;

// Revoke with event_token
void Activated(event_token const& cookie) const;

// Revoke with event_revoker
Activated_revoker Activated(auto_revoker_t, TypedEventHandler<CoreWindow, WindowActivatedEventArgs> const& handler) const;
public event TypedEventHandler Activated<CoreWindow, WindowActivatedEventArgs>
Public Event TypedEventHandler Activated( Of ( Of CoreWindow ), ( Of WindowActivatedEventArgs ))

AutomationProviderRequested AutomationProviderRequested AutomationProviderRequested AutomationProviderRequested

Specifies the event that is fired when a request for an automation handler is generated.

public : event TypedEventHandler AutomationProviderRequested<CoreWindow, AutomationProviderRequestedEventArgs>
// Register
event_token AutomationProviderRequested(TypedEventHandler<CoreWindow, AutomationProviderRequestedEventArgs> const& handler) const;

// Revoke with event_token
void AutomationProviderRequested(event_token const& cookie) const;

// Revoke with event_revoker
AutomationProviderRequested_revoker AutomationProviderRequested(auto_revoker_t, TypedEventHandler<CoreWindow, AutomationProviderRequestedEventArgs> const& handler) const;
public event TypedEventHandler AutomationProviderRequested<CoreWindow, AutomationProviderRequestedEventArgs>
Public Event TypedEventHandler AutomationProviderRequested( Of ( Of CoreWindow ), ( Of AutomationProviderRequestedEventArgs ))

CharacterReceived CharacterReceived CharacterReceived CharacterReceived

Specifies the event that is fired when a new character is received by the input queue.

public : event TypedEventHandler CharacterReceived<CoreWindow, CharacterReceivedEventArgs>
// Register
event_token CharacterReceived(TypedEventHandler<CoreWindow, CharacterReceivedEventArgs> const& handler) const;

// Revoke with event_token
void CharacterReceived(event_token const& cookie) const;

// Revoke with event_revoker
CharacterReceived_revoker CharacterReceived(auto_revoker_t, TypedEventHandler<CoreWindow, CharacterReceivedEventArgs> const& handler) const;
public event TypedEventHandler CharacterReceived<CoreWindow, CharacterReceivedEventArgs>
Public Event TypedEventHandler CharacterReceived( Of ( Of CoreWindow ), ( Of CharacterReceivedEventArgs ))

Closed Closed Closed Closed

Specifies the event that is fired when a window is closed (or the app terminates altogether).

public : event TypedEventHandler Closed<CoreWindow, CoreWindowEventArgs>
// Register
event_token Closed(TypedEventHandler<CoreWindow, CoreWindowEventArgs> const& handler) const;

// Revoke with event_token
void Closed(event_token const& cookie) const;

// Revoke with event_revoker
Closed_revoker Closed(auto_revoker_t, TypedEventHandler<CoreWindow, CoreWindowEventArgs> const& handler) const;
public event TypedEventHandler Closed<CoreWindow, CoreWindowEventArgs>
Public Event TypedEventHandler Closed( Of ( Of CoreWindow ), ( Of CoreWindowEventArgs ))

InputEnabled InputEnabled InputEnabled InputEnabled

Specifies an event that occurs when input is enabled or disabled for the window.

public : event TypedEventHandler InputEnabled<CoreWindow, InputEnabledEventArgs>
// Register
event_token InputEnabled(TypedEventHandler<CoreWindow, InputEnabledEventArgs> const& handler) const;

// Revoke with event_token
void InputEnabled(event_token const& cookie) const;

// Revoke with event_revoker
InputEnabled_revoker InputEnabled(auto_revoker_t, TypedEventHandler<CoreWindow, InputEnabledEventArgs> const& handler) const;
public event TypedEventHandler InputEnabled<CoreWindow, InputEnabledEventArgs>
Public Event TypedEventHandler InputEnabled( Of ( Of CoreWindow ), ( Of InputEnabledEventArgs ))

KeyDown KeyDown KeyDown KeyDown

Specifies the event that is fired when a non-system key is pressed down.

public : event TypedEventHandler KeyDown<CoreWindow, KeyEventArgs>
// Register
event_token KeyDown(TypedEventHandler<CoreWindow, KeyEventArgs> const& handler) const;

// Revoke with event_token
void KeyDown(event_token const& cookie) const;

// Revoke with event_revoker
KeyDown_revoker KeyDown(auto_revoker_t, TypedEventHandler<CoreWindow, KeyEventArgs> const& handler) const;
public event TypedEventHandler KeyDown<CoreWindow, KeyEventArgs>
Public Event TypedEventHandler KeyDown( Of ( Of CoreWindow ), ( Of KeyEventArgs ))

KeyUp KeyUp KeyUp KeyUp

Specifies the event that is fired when a non-system key is released after a press.

public : event TypedEventHandler KeyUp<CoreWindow, KeyEventArgs>
// Register
event_token KeyUp(TypedEventHandler<CoreWindow, KeyEventArgs> const& handler) const;

// Revoke with event_token
void KeyUp(event_token const& cookie) const;

// Revoke with event_revoker
KeyUp_revoker KeyUp(auto_revoker_t, TypedEventHandler<CoreWindow, KeyEventArgs> const& handler) const;
public event TypedEventHandler KeyUp<CoreWindow, KeyEventArgs>
Public Event TypedEventHandler KeyUp( Of ( Of CoreWindow ), ( Of KeyEventArgs ))

PointerCaptureLost PointerCaptureLost PointerCaptureLost PointerCaptureLost

Specifies the event that occurs when a pointer moves to another window. This event is fired after PointerExited and is the final pointer event that is raised for a window.

public : event TypedEventHandler PointerCaptureLost<CoreWindow, PointerEventArgs>
// Register
event_token PointerCaptureLost(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerCaptureLost(event_token const& cookie) const;

// Revoke with event_revoker
PointerCaptureLost_revoker PointerCaptureLost(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerCaptureLost<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerCaptureLost( Of ( Of CoreWindow ), ( Of PointerEventArgs ))
See Also

PointerEntered PointerEntered PointerEntered PointerEntered

Specifies the event that occurs when a pointer moves into the bounding box of the window.

public : event TypedEventHandler PointerEntered<CoreWindow, PointerEventArgs>
// Register
event_token PointerEntered(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerEntered(event_token const& cookie) const;

// Revoke with event_revoker
PointerEntered_revoker PointerEntered(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerEntered<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerEntered( Of ( Of CoreWindow ), ( Of PointerEventArgs ))

Remarks

For touch points this event will be raised before the PointerPressed event.

See Also

PointerExited PointerExited PointerExited PointerExited

Specifies the event that occurs when the pointer moves outside the bounding box of the window.

public : event TypedEventHandler PointerExited<CoreWindow, PointerEventArgs>
// Register
event_token PointerExited(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerExited(event_token const& cookie) const;

// Revoke with event_revoker
PointerExited_revoker PointerExited(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerExited<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerExited( Of ( Of CoreWindow ), ( Of PointerEventArgs ))

Remarks

For touch points this event will be raised before the PointerReleased event.

See Also

PointerMoved PointerMoved PointerMoved PointerMoved

Specifies the event that occurs when a pointer moves within the bounding box of the window.

public : event TypedEventHandler PointerMoved<CoreWindow, PointerEventArgs>
// Register
event_token PointerMoved(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerMoved(event_token const& cookie) const;

// Revoke with event_revoker
PointerMoved_revoker PointerMoved(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerMoved<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerMoved( Of ( Of CoreWindow ), ( Of PointerEventArgs ))
See Also

PointerPressed PointerPressed PointerPressed PointerPressed

Occurs when a mouse button is clicked, or the digitizer surface has been touched by a finger or pen, within the bounding rectangle of the app.

An interaction session starts when a single contact is detected and ends when that contact, and all subsequent contacts in the same session, are no longer detected.

This event is fired for the first contact detected in the interaction session. Details for all other concurrent contact pointers are exposed through a PointerPointProperties object (obtained by getting the Properties property from a PointerPoint object).

public : event TypedEventHandler PointerPressed<CoreWindow, PointerEventArgs>
// Register
event_token PointerPressed(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerPressed(event_token const& cookie) const;

// Revoke with event_revoker
PointerPressed_revoker PointerPressed(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerPressed<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerPressed( Of ( Of CoreWindow ), ( Of PointerEventArgs ))
See Also

PointerReleased PointerReleased PointerReleased PointerReleased

Occurs when a pressed mouse button is released, or a touch or pen contact is lifted from the digitizer surface, within the bounding rectangle of the app (or outside the bounding rectangle, if the pointer is captured).

An interaction session starts when a single contact is detected and ends when that contact, and all subsequent contacts in the same session, are no longer detected.

This event is fired for each contact detected in the interaction session (except for mouse, where this event is fired only when the last mouse button is released).

public : event TypedEventHandler PointerReleased<CoreWindow, PointerEventArgs>
// Register
event_token PointerReleased(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerReleased(event_token const& cookie) const;

// Revoke with event_revoker
PointerReleased_revoker PointerReleased(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerReleased<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerReleased( Of ( Of CoreWindow ), ( Of PointerEventArgs ))
See Also

PointerWheelChanged PointerWheelChanged PointerWheelChanged PointerWheelChanged

Specifies the event that occurs when the mouse wheel is rotated.

public : event TypedEventHandler PointerWheelChanged<CoreWindow, PointerEventArgs>
// Register
event_token PointerWheelChanged(TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;

// Revoke with event_token
void PointerWheelChanged(event_token const& cookie) const;

// Revoke with event_revoker
PointerWheelChanged_revoker PointerWheelChanged(auto_revoker_t, TypedEventHandler<CoreWindow, PointerEventArgs> const& handler) const;
public event TypedEventHandler PointerWheelChanged<CoreWindow, PointerEventArgs>
Public Event TypedEventHandler PointerWheelChanged( Of ( Of CoreWindow ), ( Of PointerEventArgs ))
See Also

SizeChanged SizeChanged SizeChanged SizeChanged

Specifies the event that raises when the window size is changed.

public : event TypedEventHandler SizeChanged<CoreWindow, WindowSizeChangedEventArgs>
// Register
event_token SizeChanged(TypedEventHandler<CoreWindow, WindowSizeChangedEventArgs> const& handler) const;

// Revoke with event_token
void SizeChanged(event_token const& cookie) const;

// Revoke with event_revoker
SizeChanged_revoker SizeChanged(auto_revoker_t, TypedEventHandler<CoreWindow, WindowSizeChangedEventArgs> const& handler) const;
public event TypedEventHandler SizeChanged<CoreWindow, WindowSizeChangedEventArgs>
Public Event TypedEventHandler SizeChanged( Of ( Of CoreWindow ), ( Of WindowSizeChangedEventArgs ))

Remarks

This event fires when the window size changes or when one of the following properties changes:

TouchHitTesting TouchHitTesting TouchHitTesting TouchHitTesting

Specifies the event that occurs when a touch contact area falls within a window that is registered for touch hit testing.

public : event TypedEventHandler TouchHitTesting<CoreWindow, TouchHitTestingEventArgs>
// Register
event_token TouchHitTesting(TypedEventHandler<CoreWindow, TouchHitTestingEventArgs> const& handler) const;

// Revoke with event_token
void TouchHitTesting(event_token const& cookie) const;

// Revoke with event_revoker
TouchHitTesting_revoker TouchHitTesting(auto_revoker_t, TypedEventHandler<CoreWindow, TouchHitTestingEventArgs> const& handler) const;
public event TypedEventHandler TouchHitTesting<CoreWindow, TouchHitTestingEventArgs>
Public Event TypedEventHandler TouchHitTesting( Of ( Of CoreWindow ), ( Of TouchHitTestingEventArgs ))

VisibilityChanged VisibilityChanged VisibilityChanged VisibilityChanged

Specifies the event that occurs when the window visibility is changed.

public : event TypedEventHandler VisibilityChanged<CoreWindow, VisibilityChangedEventArgs>
// Register
event_token VisibilityChanged(TypedEventHandler<CoreWindow, VisibilityChangedEventArgs> const& handler) const;

// Revoke with event_token
void VisibilityChanged(event_token const& cookie) const;

// Revoke with event_revoker
VisibilityChanged_revoker VisibilityChanged(auto_revoker_t, TypedEventHandler<CoreWindow, VisibilityChangedEventArgs> const& handler) const;
public event TypedEventHandler VisibilityChanged<CoreWindow, VisibilityChangedEventArgs>
Public Event TypedEventHandler VisibilityChanged( Of ( Of CoreWindow ), ( Of VisibilityChangedEventArgs ))