ApplicationView.PreferredLaunchWindowingMode Property

Definition

Gets or sets a value that indicates the windowing mode the app launches with.

public:
 static property ApplicationViewWindowingMode PreferredLaunchWindowingMode { ApplicationViewWindowingMode get(); void set(ApplicationViewWindowingMode value); };
static ApplicationViewWindowingMode PreferredLaunchWindowingMode();

static void PreferredLaunchWindowingMode(ApplicationViewWindowingMode value);
public static ApplicationViewWindowingMode PreferredLaunchWindowingMode { get; set; }
var applicationViewWindowingMode = ApplicationView.preferredLaunchWindowingMode;
ApplicationView.preferredLaunchWindowingMode = applicationViewWindowingMode;
Public Shared Property PreferredLaunchWindowingMode As ApplicationViewWindowingMode

Property Value

An enumeration value that indicates the windowing mode of the app.

Examples

This example shows how to toggle full-screen mode and set the PreferredLaunchWindowingMode property.

<Button x:Name="ToggleFullScreenModeButton" Content="Toggle full screen" 
        Click="ToggleFullScreenModeButton_Click">
private void ToggleFullScreenModeButton_Click(object sender, RoutedEventArgs e)
{
    var view = ApplicationView.GetForCurrentView();
    if (view.IsFullScreenMode)
    {
        view.ExitFullScreenMode();
        ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        // The SizeChanged event will be raised when the exit from full-screen mode is complete.
    }
    else
    {
        if (view.TryEnterFullScreenMode())
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            // The SizeChanged event will be raised when the entry to full-screen mode is complete.
        }
    }
}

Remarks

By default, PreferredLaunchWindowingMode is set to Auto. In this mode, the size and position of your app window on startup is managed automatically by Windows.

You can set PreferredLaunchWindowingMode to override the automatic behavior with one of these values.

For the very first launch of an app the PreferredLaunchWindowingMode will always be Auto and the ApplicationView.PreferredLaunchViewSize will be determined by system policies. The API applies to the next launch of the app.

You typically set this property when the user sets their preference via an in-app option, or when you call TryEnterFullScreenMode and ExitFullScreenMode. You can set this property during app startup (before the call to CoreWindow.Activate) to specify a first launch behavior. However, you shouldn't set it during every launch as this can cause your app to do extra sizing and positioning work during startup.

Applies to

See also