Defines a window object and its input events, and basic user interface behaviors.
Syntax
Attributes
- MarshalingBehaviorAttribute(Standard)
- MuseAttribute()
- StaticAttribute(Windows.UI.Core.ICoreWindowStatic, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The CoreWindow class has these types of members:
Events
The CoreWindow class has these events.
| Event | Description |
|---|---|
| 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.
| Method | Description |
|---|---|
| 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.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the automation provider assigned to this window. | |
| Read-only | Gets the bounding rectangle of the window. | |
| Read-only | Gets the set of custom properties for the window. | |
| Read-only | Gets the event dispatcher for the window. | |
| Read/write | Gets or sets the horizontal origin of the window's reading order alignment. | |
| Read/write | Gets or sets a value that indicates whether input is enabled for the Windows Store app. | |
| Read/write | Windows Phone only. Gets or sets whether the on-screen keyboard is displayed to the user for text input. | |
| Read/write | Windows Phone only. Gets or sets the KeyboardInputBuffer object that is used to receive buffered text input. | |
| Read/write | Gets or sets the cursor used by the Windows Store app. | |
| Read-only | Gets the client coordinates of the pointer. | |
| Read-only | Gets 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 |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 2/25/2013