-api-id | -api-type |
---|---|
T:Windows.ApplicationModel.Core.CoreApplicationView |
winrt class |
Represents an app window and its thread.
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).
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();
}
// ...
}
Windows version | SDK version | Value added |
---|---|---|
1703 | 15063 | Properties |
1709 | 16299 | DispatcherQueue |
DirectX swap chain implementation sample, CoreApplication.CreateNewView, CoreApplication.GetCurrentView