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 ICoreWindowpublic interface ICoreWindowPublic 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 object AutomationHostProvider { get; }public object AutomationHostProvider { get; }Public ReadOnly Property AutomationHostProvider As objectpublic object AutomationHostProvider { get; }
Value
object object object

The automation provider for this window.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Bounds Bounds Bounds Bounds

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

public Rect Bounds { get; }public Rect Bounds { get; }Public ReadOnly Property Bounds As Rectpublic Rect Bounds { get; }
Value
Rect Rect Rect

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

CustomProperties CustomProperties CustomProperties CustomProperties

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

public IPropertySet CustomProperties { get; }public IPropertySet CustomProperties { get; }Public ReadOnly Property CustomProperties As IPropertySetpublic IPropertySet CustomProperties { get; }
Value
IPropertySet IPropertySet IPropertySet

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Dispatcher Dispatcher Dispatcher Dispatcher

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

public CoreDispatcher Dispatcher { get; }public CoreDispatcher Dispatcher { get; }Public ReadOnly Property Dispatcher As CoreDispatcherpublic CoreDispatcher Dispatcher { get; }
Value
CoreDispatcher CoreDispatcher CoreDispatcher

The event dispatcher for the window.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }public CoreWindowFlowDirection FlowDirection { get; set; }Public ReadWrite Property FlowDirection As CoreWindowFlowDirectionpublic CoreWindowFlowDirection FlowDirection { get; set; }
Value
CoreWindowFlowDirection CoreWindowFlowDirection CoreWindowFlowDirection

The flow direction of the window's reading layout.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsInputEnabled IsInputEnabled IsInputEnabled IsInputEnabled

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

public bool IsInputEnabled { get; set; }public bool IsInputEnabled { get; set; }Public ReadWrite Property IsInputEnabled As boolpublic bool IsInputEnabled { get; set; }
Value
bool bool bool

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

PointerCursor PointerCursor PointerCursor PointerCursor

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

public CoreCursor PointerCursor { get; set; }public CoreCursor PointerCursor { get; set; }Public ReadWrite Property PointerCursor As CoreCursorpublic CoreCursor PointerCursor { get; set; }
Value
CoreCursor CoreCursor CoreCursor

The window's cursor.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

PointerPosition PointerPosition PointerPosition PointerPosition

Specifies a property that gets the position of the pointer.

public Point PointerPosition { get; }public Point PointerPosition { get; }Public ReadOnly Property PointerPosition As Pointpublic Point PointerPosition { get; }
Value
Point Point Point

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Visible Visible Visible Visible

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

public bool Visible { get; }public bool Visible { get; }Public ReadOnly Property Visible As boolpublic bool Visible { get; }
Value
bool bool bool

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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()public void Activate()Public Function Activate() As voidpublic void Activate()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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()public void Close()Public Function Close() As voidpublic void Close()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This method also causes the ProcessEvents(CoreProcessEventsOption) 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)public CoreVirtualKeyStates GetAsyncKeyState(VirtualKey virtualKey)Public Function GetAsyncKeyState(virtualKey As VirtualKey) As CoreVirtualKeyStatespublic CoreVirtualKeyStates GetAsyncKeyState(VirtualKey virtualKey)
Parameters
virtualKey
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.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Specifies a method that gets the state of a key.

public CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey)public CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey)Public Function GetKeyState(virtualKey As VirtualKey) As CoreVirtualKeyStatespublic CoreVirtualKeyStates GetKeyState(VirtualKey virtualKey)
Parameters
virtualKey
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.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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()public void ReleasePointerCapture()Public Function ReleasePointerCapture() As voidpublic void ReleasePointerCapture()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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()public void SetPointerCapture()Public Function SetPointerCapture() As voidpublic void SetPointerCapture()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 abstract event TypedEventHandler Activatedpublic abstract event TypedEventHandler ActivatedPublic MustInherit Event Activatedpublic abstract event TypedEventHandler Activated
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

AutomationProviderRequested AutomationProviderRequested AutomationProviderRequested AutomationProviderRequested

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

public abstract event TypedEventHandler AutomationProviderRequestedpublic abstract event TypedEventHandler AutomationProviderRequestedPublic MustInherit Event AutomationProviderRequestedpublic abstract event TypedEventHandler AutomationProviderRequested
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CharacterReceived CharacterReceived CharacterReceived CharacterReceived

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

public abstract event TypedEventHandler CharacterReceivedpublic abstract event TypedEventHandler CharacterReceivedPublic MustInherit Event CharacterReceivedpublic abstract event TypedEventHandler CharacterReceived
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Closed Closed Closed Closed

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

public abstract event TypedEventHandler Closedpublic abstract event TypedEventHandler ClosedPublic MustInherit Event Closedpublic abstract event TypedEventHandler Closed
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

InputEnabled InputEnabled InputEnabled InputEnabled

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

public abstract event TypedEventHandler InputEnabledpublic abstract event TypedEventHandler InputEnabledPublic MustInherit Event InputEnabledpublic abstract event TypedEventHandler InputEnabled
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

KeyDown KeyDown KeyDown KeyDown

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

public abstract event TypedEventHandler KeyDownpublic abstract event TypedEventHandler KeyDownPublic MustInherit Event KeyDownpublic abstract event TypedEventHandler KeyDown
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

KeyUp KeyUp KeyUp KeyUp

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

public abstract event TypedEventHandler KeyUppublic abstract event TypedEventHandler KeyUpPublic MustInherit Event KeyUppublic abstract event TypedEventHandler KeyUp
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 abstract event TypedEventHandler PointerCaptureLostpublic abstract event TypedEventHandler PointerCaptureLostPublic MustInherit Event PointerCaptureLostpublic abstract event TypedEventHandler PointerCaptureLost
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

PointerEntered PointerEntered PointerEntered PointerEntered

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

public abstract event TypedEventHandler PointerEnteredpublic abstract event TypedEventHandler PointerEnteredPublic MustInherit Event PointerEnteredpublic abstract event TypedEventHandler PointerEntered
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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

PointerExited PointerExited PointerExited PointerExited

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

public abstract event TypedEventHandler PointerExitedpublic abstract event TypedEventHandler PointerExitedPublic MustInherit Event PointerExitedpublic abstract event TypedEventHandler PointerExited
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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

PointerMoved PointerMoved PointerMoved PointerMoved

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

public abstract event TypedEventHandler PointerMovedpublic abstract event TypedEventHandler PointerMovedPublic MustInherit Event PointerMovedpublic abstract event TypedEventHandler PointerMoved
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 abstract event TypedEventHandler PointerPressedpublic abstract event TypedEventHandler PointerPressedPublic MustInherit Event PointerPressedpublic abstract event TypedEventHandler PointerPressed
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 abstract event TypedEventHandler PointerReleasedpublic abstract event TypedEventHandler PointerReleasedPublic MustInherit Event PointerReleasedpublic abstract event TypedEventHandler PointerReleased
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

PointerWheelChanged PointerWheelChanged PointerWheelChanged PointerWheelChanged

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

public abstract event TypedEventHandler PointerWheelChangedpublic abstract event TypedEventHandler PointerWheelChangedPublic MustInherit Event PointerWheelChangedpublic abstract event TypedEventHandler PointerWheelChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

SizeChanged SizeChanged SizeChanged SizeChanged

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

public abstract event TypedEventHandler SizeChangedpublic abstract event TypedEventHandler SizeChangedPublic MustInherit Event SizeChangedpublic abstract event TypedEventHandler SizeChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 abstract event TypedEventHandler TouchHitTestingpublic abstract event TypedEventHandler TouchHitTestingPublic MustInherit Event TouchHitTestingpublic abstract event TypedEventHandler TouchHitTesting
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

VisibilityChanged VisibilityChanged VisibilityChanged VisibilityChanged

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

public abstract event TypedEventHandler VisibilityChangedpublic abstract event TypedEventHandler VisibilityChangedPublic MustInherit Event VisibilityChangedpublic abstract event TypedEventHandler VisibilityChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)