I​Core​Window I​Core​Window I​Core​Window 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

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

public : PlatForm::Object AutomationHostProvider { get; }public object AutomationHostProvider { get; }Public ReadOnly Property AutomationHostProvider As object
Value
PlatForm::Object object object

The automation provider for this window.

Attributes

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 Rect
Value
Rect Rect Rect

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

Attributes

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

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 IPropertySet
Value
IPropertySet IPropertySet IPropertySet

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

Attributes
See Also

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 CoreDispatcher
Value
CoreDispatcher CoreDispatcher CoreDispatcher

The event dispatcher for the window.

Attributes
See Also

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 CoreWindowFlowDirection
Value
CoreWindowFlowDirection CoreWindowFlowDirection CoreWindowFlowDirection

The flow direction of the window's reading layout.

Attributes
See Also

IsInputEnabled IsInputEnabled IsInputEnabled

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

public : PlatForm::Boolean IsInputEnabled { get; set; }public bool IsInputEnabled { get; set; }Public ReadWrite Property IsInputEnabled As bool
Value
PlatForm::Boolean bool bool

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

Attributes

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 CoreCursor
Value
CoreCursor CoreCursor CoreCursor

The window's cursor.

Attributes

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 Point
Value
Point Point Point

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

Attributes

Visible Visible Visible

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

public : PlatForm::Boolean Visible { get; }public bool Visible { get; }Public ReadOnly Property Visible As bool
Value
PlatForm::Boolean bool bool

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

Attributes

Methods

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 void
Attributes

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()

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

public : void Close()public void Close()Public Function Close() As void
Attributes

Remarks

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

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 CoreVirtualKeyStates
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

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 CoreVirtualKeyStates
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
See Also

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 void
Attributes

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 void
Attributes

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

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

public : abstract event TypedEventHandler Activatedpublic abstract event TypedEventHandler ActivatedPublic MustInherit Event Activated
Attributes

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 AutomationProviderRequested
Attributes

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 CharacterReceived
Attributes

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 Closed
Attributes

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 InputEnabled
Attributes

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 KeyDown
Attributes

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 KeyUp
Attributes

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 PointerCaptureLost
Attributes
See Also

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 PointerEntered
Attributes

Remarks

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

See Also

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 PointerExited
Attributes

Remarks

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

See Also

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 PointerMoved
Attributes
See Also

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 PointerPressed
Attributes
See Also

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 PointerReleased
Attributes
See Also

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 PointerWheelChanged
Attributes
See Also

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 SizeChanged
Attributes

Remarks

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

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 TouchHitTesting
Attributes

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 VisibilityChanged
Attributes