CoreApplicationView CoreApplicationView CoreApplicationView CoreApplicationView Class

Definition

Represents an app window and its thread.

public : sealed class CoreApplicationView : ICoreApplicationView, ICoreApplicationView2, ICoreApplicationView3, ICoreApplicationView5, ICoreApplicationView6
struct winrt::Windows::ApplicationModel::Core::CoreApplicationView : ICoreApplicationView, ICoreApplicationView2, ICoreApplicationView3, ICoreApplicationView5, ICoreApplicationView6
public sealed class CoreApplicationView : ICoreApplicationView, ICoreApplicationView2, ICoreApplicationView3, ICoreApplicationView5, ICoreApplicationView6
Public NotInheritable Class CoreApplicationView Implements ICoreApplicationView, ICoreApplicationView2, ICoreApplicationView3, ICoreApplicationView5, ICoreApplicationView6
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

// ...
}

Properties

CoreWindow CoreWindow CoreWindow CoreWindow

Gets the app window associated with the current view.

Dispatcher Dispatcher Dispatcher Dispatcher

Gets the event message dispatcher associated with the current view.

DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue for the window.

IsComponent IsComponent IsComponent 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 IsHosted IsHosted IsHosted

Gets the value that indicates whether this app view is hosted or not.

IsMain IsMain IsMain IsMain

Gets a value that indicates whether this app view is the main app view or not.

Properties Properties Properties Properties

Gets properties that the app can associate with the view.

TitleBar TitleBar TitleBar TitleBar

Gets the title bar associated with the current view.

Events

Activated Activated Activated Activated

Occurs when the view is activated.

HostedViewClosing HostedViewClosing HostedViewClosing HostedViewClosing

Indicates that the hosted view is closing. Provides an opportunity for hosted window scenarios to defer the tear down of the hosted view.

See Also