Delen via


ApplicationView.ExitFullScreenMode Method

Definition

Takes the app out of full-screen mode.

public:
 virtual void ExitFullScreenMode() = ExitFullScreenMode;
void ExitFullScreenMode();
public void ExitFullScreenMode();
function exitFullScreenMode()
Public Sub ExitFullScreenMode ()

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

To preserve full-screen mode when a user restarts the app, set PreferredLaunchWindowingMode to FullScreen if the call to TryEnterFullScreenMode returns true. When you call ExitFullScreenMode, you should set PreferredLaunchWindowingMode back to Auto or PreferredLaunchViewSize.

The system raises the CoreWindow.SizeChanged event when the view enters or exits full-screen mode. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

Applies to

See also