Share via


CoreApplicationView.IsHosted Property

Definition

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

public:
 property bool IsHosted { bool get(); };
bool IsHosted();
public bool IsHosted { get; }
var boolean = coreApplicationView.isHosted;
Public ReadOnly Property IsHosted As Boolean

Property Value

Boolean

bool

If true, this app view is hosted; if false, it isn't.

Examples

Here's a simple example that demonstrates how to use the IsHosted property:

using Windows.ApplicationModel.Core;
using Windows.UI.Xaml;

namespace ExampleApp
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            // Check if the current app view is hosted
            bool isHosted = CoreApplication.GetCurrentView().IsHosted;

            // Display the result
            if (isHosted)
            {
                System.Diagnostics.Debug.WriteLine("The app view is hosted.");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("The app view is not hosted.");
            }
        }
    }
}

Remarks

An app view is hosted when the process that launches it controls its lifetime. For example, the window that opens when a FileOpenPicker is launched is hosted.

Applies to