CoreWindow class

Applies to Windows and Windows Phone

Represents the Windows Store app with input events and basic user interface behaviors.

Syntax


public sealed class CoreWindow : ICoreWindow

Attributes

[MarshalingBehavior(Standard)]
[Muse()]
[Version(0x06020000)]
[WebHostHidden()]

Members

The CoreWindow class has these types of members:

Events

The CoreWindow class has these events.

EventDescription
Activated Is fired when the window completes activation or deactivation.
AutomationProviderRequested Is fired when a request for an automation handler is generated.
CharacterReceived Is fired when a new character is received by the input queue.
Closed Is fired when the app terminates.
InputEnabled Occurs when input is enabled or disabled for the Windows Store app.
KeyDown Is fired when a non-system key is pressed.
KeyUp Is fired when a non-system key is released after a press.
PointerCaptureLost Occurs when a pointer moves to another Windows Store app.
PointerEntered Occurs when a pointer moves into the bounding box of the Windows Store app.
PointerExited Occurs when the pointer moves outside the bounding box of the Windows Store app.
PointerMoved Occurs when a pointer moves within the bounding box of the Windows Store app.
PointerPressed Occurs when a mouse button is clicked, or a touch or pen contact is detected, within the bounding rectangle of the Windows Store app.
PointerReleased Occurs when a mouse button is released, or a touch or pen contact is lifted, within the bounding rectangle of the Windows Store app.
PointerWheelChanged Occurs when the wheel button is rotated.
SizeChanged Is fired when the window size is changed.
TouchHitTesting Occurs when a touch contact area intersects the bounding rectangle (or polygon) of a window that is registered for touch hit testing.
VisibilityChanged Is fired when the window visibility is changed.

 

Methods

The CoreWindow class has these methods. It also inherits methods from the Object class.

MethodDescription
Activate Activates the window.
Close Closes a secondary window and exits the message loop.
GetAsyncKeyState Returns the state of a virtual key asynchronously.
GetForCurrentThread Gets the CoreWindow instance for the currently active thread.
GetKeyState Gets the state of a key.
ReleasePointerCapture Disables pointer capture for the Windows Store app.
SetPointerCapture Enables pointer capture for the Windows Store app.

 

Properties

The CoreWindow class has these properties.

PropertyAccess typeDescription

AutomationHostProvider

Read-onlyGets the automation provider assigned to this window.

Bounds

Read-onlyGets the bounding rectangle of the window.

CustomProperties

Read-onlyGets the set of custom properties for the window.

Dispatcher

Read-onlyGets the event dispatcher for the window.

FlowDirection

Read/writeGets or sets the horizontal origin of the window's reading order alignment.

IsInputEnabled

Read/writeGets or sets a value that indicates whether input is enabled for the Windows Store app.

IsKeyboardInputEnabled

Read/write

KeyboardInputBuffer

Read/write

PointerCursor

Read/writeGets or sets the cursor used by the Windows Store app.

PointerPosition

Read-onlyGets the client coordinates of the pointer.

Visible

Read-onlyGets a value that indicates whether the window is visible.

 

Remarks

New instances of this class are obtained by calling CoreApplication.CreateNewView and then inspecting the CoreWindow property on the returned CoreApplicationView instance. Or you can obtain existing CoreWindow instances for a running app from the CoreApplication.Views property, or by calling CoreWindow.GetForCurrentThread, as seen in the following example.


void MyCoreWindowEvents::Run() // this is an implementation of IFrameworkView::Run() used to show context
{
    CoreWindow::GetForCurrentThread()->Activate();

    /...

    CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit);
}

Note  : This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX).

Windows Phone 8

This API is supported in native apps only.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.UI.Core
Windows::UI::Core [C++]

Metadata

Windows.winmd

See also

CoreApplicationView
CoreApplication.CreateNewView
CoreApplication.Views

 

 

Show:
© 2014 Microsoft