Windows.ApplicationModel.Core.CoreApplicationView

June 19, 2020 ยท View on GitHub

-description

Represents an app window and its thread.

-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 versionSDK versionValue added
170315063Properties
170916299DispatcherQueue

-examples

-see-also

DirectX swap chain implementation sample, CoreApplication.CreateNewView, CoreApplication.GetCurrentView