WPF WindowChrome全屏

时间:2015-08-17 19:12:20

标签: c# wpf xaml

我对 WindowChrome 有疑问。当我尝试全屏时,它并不总是转到任务栏。我不知道如何进入任务栏以便不在全屏任务栏中看到。

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <System:Double x:Key="CaptionShellHeight">5</System:Double>
    <GridLength x:Key="CaptionRowHeight">5</GridLength>
</Window.Resources>
<Window.Style>
    <Style TargetType="{x:Type Window}">
        <Setter Property="shell:WindowChrome.WindowChrome">
            <Setter.Value>
                <shell:WindowChrome CaptionHeight="{StaticResource CaptionShellHeight}"
                                    CornerRadius="0"
                                    GlassFrameThickness="0,0,0,1"
                                    NonClientFrameEdges="None"
                                    ResizeBorderThickness="5"
                                    UseAeroCaptionButtons="true"/>
            </Setter.Value>
        </Setter>
    </Style>
</Window.Style>

  private void fullscreen(object sender, RoutedEventArgs e)
    {
        if (this.WindowState == WindowState.Maximized)
        {
            this.WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
            this.WindowState = WindowState.Normal;
        }
        else
        {
            this.WindowStyle = System.Windows.WindowStyle.None;
            this.WindowState = WindowState.Maximized;
        }
    }

非常感谢

1 个答案:

答案 0 :(得分:0)

尝试这样做:

WindowChrome.GlassFrameThickness = -1