0

このコードを使用して、タイトル バーの表示と非表示を切り替え、タスク バーを削除しています。

    public void EnterFullScreenMode()
    {
        this.WindowStyle = System.Windows.WindowStyle.None;
        this.WindowState = System.Windows.WindowState.Maximized;

        IsFullScreen = true;
    }

    public void ExitFullScreenMode()
    {
        this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
        this.WindowState = System.Windows.WindowState.Normal;

        IsFullScreen = false;
    }

タスクバーの表示\非表示は完璧に機能し、タイトルバーの非表示も機能しますが、タイトルバーの表示が機能せず、「フルスクリーン」モードを終了したいのですが、タイトルバーが非表示になっています。

何が問題になる可能性がありますか?

4

1 に答える 1

2

私はこのスタイルを使用しましたが、うまくいきます。フルスクリーンモードのプロパティが既にあるため、スタイルを使用する方が優れており、MVVMにも適しています-

<Window.Style>
    <Style TargetType="{x:Type Window}">
        <Setter Property="WindowState" Value="Normal" />
        <Setter Property="WindowStyle" Value="SingleBorderWindow" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsFullScreen}" Value="True">
                <Setter Property="WindowState" Value="Maximized" />
                <Setter Property="WindowStyle" Value="None" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Window.Style>
于 2016-09-20T14:08:15.067 に答える