ICoreWindow ICoreWindow ICoreWindow Interface

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

Syntax

Declaration

public interface ICoreWindowpublic interface ICoreWindowPublic Interface ICoreWindow

Properties summary

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

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

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

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

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.

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

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

Specifies a property that gets the position of the pointer.

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

Methods summary

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

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

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

Specifies a method that gets the state of a key.

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

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.

Events summary

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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; }

    Property Value

    • object
      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; }public Rect Bounds { get; }Public ReadOnly Property Bounds As Rectpublic Rect Bounds { get; }

    Property Value

    • 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
  • 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; }

    Property Value

  • 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; }

    Property Value

  • 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; }

    Property Value

  • 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; }

    Property Value

    • bool
      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; }public CoreCursor PointerCursor { get; set; }Public ReadWrite Property PointerCursor As CoreCursorpublic CoreCursor PointerCursor { get; set; }

    Property Value

  • 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; }

    Property Value

    • 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 bool Visible { get; }public bool Visible { get; }Public ReadOnly Property Visible As boolpublic bool Visible { get; }

    Property Value

    • bool
      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()public void Activate()Public Function Activate() As voidpublic void Activate()

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

    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

    Returns

  • 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

    Returns

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

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

    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

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

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

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.GuidAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Core.dll