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 回答