Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 2.39 KB

coreapplicationview.md

File metadata and controls

75 lines (60 loc) · 2.39 KB
-api-id -api-type
T:Windows.ApplicationModel.Core.CoreApplicationView
winrt class

Windows.ApplicationModel.Core.CoreApplicationView

-description

Represents an app window and its thread.

-remarks

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();
    }

// ...
}

Version history

Windows version SDK version Value added
1703 15063 Properties
1709 16299 DispatcherQueue

-examples

-see-also

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