CoreApplicationView Class
Definition
Represents an app window and its thread.
public ref class CoreApplicationView sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
/// [Windows.Foundation.Metadata.Muse(Version=100794368)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class CoreApplicationView final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
[Windows.Foundation.Metadata.Muse(Version=100794368)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class CoreApplicationView
Public NotInheritable Class CoreApplicationView
- Inheritance
-
CoreApplicationView
- Attributes
Windows 10 requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Remarks
The following code snippet demonstrates the activation of the CoreApplicationView and the associated CoreWindow in a view provider implementation.
struct App : implements<App, IFrameworkViewSource, IFrameworkView>
{
...
void Initialize(CoreApplicationView const& applicationView)
{
applicationView.Activated({this, &App::OnActivated });
}
void OnActivated(CoreApplicationView const& /* applicationView */, IActivatedEventArgs const& /* args */)
{
// Activate the application window, making it visible and enabling it to receive events.
CoreWindow::GetForCurrentThread().Activate();
}
}
ref class MyFrameworkView : public IFrameworkView
{
// ...
virtual void Initialize(
_In_ CoreApplicationView^ applicationView
)
{
applicationView->Activated +=
ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &MyFrameworkView::OnActivated);
}
// ...
void OnActivated(
_In_ CoreApplicationView^ applicationView,
_In_ IActivatedEventArgs^ args
)
{
// Activate the application window, making it visible and enabling it to receive events.
CoreWindow::GetForCurrentThread()->Activate();
}
// ...
}
Version history
Windows version | SDK version | Value added |
---|---|---|
1703 | 15063 | Properties |
1709 | 16299 | DispatcherQueue |
Properties
CoreWindow |
Gets the app window associated with the current view. |
Dispatcher |
Gets the event message dispatcher associated with the current view. |
DispatcherQueue |
Gets the DispatcherQueue for the window. |
IsComponent |
Gets whether the app was launched as a component that is embedded in another app. This property is reserved for internal use and is not intended to be used in your code. |
IsHosted |
Gets the value that indicates whether this app view is hosted or not. |
IsMain |
Gets a value that indicates whether this app view is the main app view or not. |
Properties |
Gets properties that the app can associate with the view. |
TitleBar |
Gets the title bar associated with the current view. |
Events
Activated |
Occurs when the view is activated. |
HostedViewClosing |
Indicates that the hosted view is closing. Provides an opportunity for hosted window scenarios to defer the tear down of the hosted view. |