共用方式為


ApplicationView.ExitFullScreenMode 方法

定義

讓應用程式退出全螢幕模式。

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

範例

此範例示範如何切換全螢幕模式,並設定 PreferredLaunchWindowingMode 屬性。

<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.
        }
    }
}

備註

若要在使用者重新開機應用程式時保留全螢幕模式,如果呼叫TryEnterFullScreenMode傳回true,請將PreferredLaunchWindowingMode設定為FullScreen。 當您呼叫 ExitFullScreenMode 時,應該將 PreferredLaunchWindowingMode 設定回 AutoPreferredLaunchViewSize

當檢視進入或結束全螢幕模式時,系統會引發 CoreWindow.SizeChanged 事件。 這會以 Window.SizeChanged 事件的形式向 XAML 應用程式公開,並將 HTML 應用程式公開為 window.resize 事件。

適用於

另請參閱