CoreApplicationView CoreApplicationView CoreApplicationView Class

Represents an app window and its thread.

Syntax

Declaration

public sealed class CoreApplicationViewpublic sealed class CoreApplicationViewPublic NotInheritable Class CoreApplicationView

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.


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 summary

Gets the app window associated with the current view.

Gets the event message dispatcher associated with the current view.

Gets whether the app was launched as a component that is embedded in another app by calling the LaunchAsync method.

This property is reserved for internal use and is not intended to be used in your code.

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

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

Gets the title bar associated with the current view.

Events summary

Occurs when the view is activated.

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

Properties

  • CoreWindow
    CoreWindow
    CoreWindow
    CoreWindow

    Gets the app window associated with the current view.

    public CoreWindow CoreWindow { get; }public CoreWindow CoreWindow { get; }Public ReadOnly Property CoreWindow As CoreWindow

    Property Value

  • Dispatcher
    Dispatcher
    Dispatcher
    Dispatcher

    Gets the event message dispatcher associated with the current view.

    public CoreDispatcher Dispatcher { get; }public CoreDispatcher Dispatcher { get; }Public ReadOnly Property Dispatcher As CoreDispatcher

    Property Value

  • IsComponent
    IsComponent
    IsComponent
    IsComponent

    Gets whether the app was launched as a component that is embedded in another app by calling the LaunchAsync method.

    This property is reserved for internal use and is not intended to be used in your code.

    public bool IsComponent { get; }public bool IsComponent { get; }Public ReadOnly Property IsComponent As bool

    Property Value

    • bool
      bool
      bool

      True if the app was launched as a component that is embedded in another app; false if the app was not launch as a component that is embedded in another app.

  • IsHosted
    IsHosted
    IsHosted
    IsHosted

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

    public bool IsHosted { get; }public bool IsHosted { get; }Public ReadOnly Property IsHosted As bool

    Property Value

    • bool
      bool
      bool

      If true, this app view is hosted; if false, it is not.

  • IsMain
    IsMain
    IsMain
    IsMain

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

    public bool IsMain { get; }public bool IsMain { get; }Public ReadOnly Property IsMain As bool

    Property Value

    • bool
      bool
      bool

      If true, this app view is the main; if false, it is not.

  • TitleBar
    TitleBar
    TitleBar
    TitleBar

    Gets the title bar associated with the current view.

    public CoreApplicationViewTitleBar TitleBar { get; }public CoreApplicationViewTitleBar TitleBar { get; }Public ReadOnly Property TitleBar As CoreApplicationViewTitleBar

    Property Value

Events

  • Activated
    Activated
    Activated
    Activated

    Occurs when the view is activated.

    public event TypedEventHandler Activatedpublic event TypedEventHandler ActivatedPublic Event 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.

    public event TypedEventHandler HostedViewClosingpublic event TypedEventHandler HostedViewClosingPublic Event HostedViewClosing

    Remarks

    Handling this event provides an opportunity to perform cleanup tasks such as closing files, flushing buffers to disk, and so on.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MuseAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.ApplicationModel.Core.dll