<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:TiefSee">

    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter" />

    <Color x:Key="WindowBackgroundColor">#FF2D2D30</Color>
    <Color x:Key="HighlightColor">#7F4BC8FF</Color>
    <Color x:Key="BlueColor">#FF4BC8FF</Color>
    <Color x:Key="ForegroundColor">#FFF4F4F5</Color>

    <SolidColorBrush x:Key="WindowBackgroundColorBrush"
                     Color="{StaticResource WindowBackgroundColor}" />
    <SolidColorBrush x:Key="HighlightColorBrush"
                     Color="{StaticResource HighlightColor}" />
    <SolidColorBrush x:Key="BlueColorBrush"
                     Color="{StaticResource BlueColor}" />
    <SolidColorBrush x:Key="ForegroundColorBrush"
                     Color="{StaticResource ForegroundColor}" />



    <Style x:Key="WindowButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="Foreground"
                Value="{DynamicResource ForegroundColorBrush}" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Padding"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Background="{TemplateBinding Background}">
                        <ContentPresenter x:Name="contentPresenter"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          Margin="{TemplateBinding Padding}"
                                          RecognizesAccessKey="True" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Background"
                                    Value="{StaticResource HighlightColorBrush}" />
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 Value="True">
                            <Setter Property="Background"
                                    Value="{DynamicResource BlueColorBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="contentPresenter"
                                    Property="Opacity"
                                    Value=".5" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="MyWindowStyle"
           TargetType="{x:Type local:MainWindow}">
        <Setter Property="Foreground"
                Value="{DynamicResource ForegroundColorBrush}" />

        <Setter Property="ResizeMode"
                Value="CanResizeWithGrip" />
        <Setter Property="UseLayoutRounding"
                Value="True" />
        <Setter Property="TextOptions.TextFormattingMode"
                Value="Display" />
        <!--<Setter Property="AllowsTransparency"
                Value="True"></Setter>-->

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MainWindow}">
                    <Border x:Name="WindowBorder"
                            Margin="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}}"
                            Background="{x:Null}">
                        <Grid>
                            <Border BorderThickness="0">
                                <AdornerDecorator>
                                    <Grid x:Name="LayoutRoot">

                                        <ContentPresenter Grid.Row="1"
                                                          Grid.RowSpan="2"
                                                          Margin="0" />






                                        <StackPanel Orientation="Horizontal"
                                                    HorizontalAlignment="Right"
                                                    VerticalAlignment="Top"
                                                    WindowChrome.IsHitTestVisibleInChrome="True"
                                                    Grid.Row="0"
                                                    Height="30">

                                            <!--<Button Command="{Binding Source={x:Static SystemCommands.MinimizeWindowCommand}}"
                                                    ToolTip="minimize"
                                                    Style="{StaticResource but_title}"
                                                    IsTabStop="False"
                                                    Width="40">
                                                <Path Data="M-99.5,97.75 L-80.968254,97.75"
                                                      HorizontalAlignment="Center"
                                                      Height="2"
                                                      Stroke="White"
                                                      VerticalAlignment="Center"
                                                      Width="11.6"
                                                      StrokeEndLineCap="Square"
                                                      Stretch="Fill"
                                                      StrokeStartLineCap="Square" />
                                            </Button>
                                            <Grid Width="40">
                                                <Button x:Name="Restore"
                                                        Command="{Binding Source={x:Static SystemCommands.RestoreWindowCommand}}"
                                                        ToolTip="restore"
                                                        Visibility="Collapsed"
                                                        IsTabStop="False"
                                                        Style="{StaticResource but_title}">
                                                    <Grid HorizontalAlignment="Center"
                                                          Height="8.941"
                                                          VerticalAlignment="Center"
                                                          Width="11.599">
                                                        <Path Data="M4.411,1 L18.692,1 18.692,10.458 15.281,10.458 15.281,14.179 1,14.179 1,4.7199998 4.411,4.7199998 z"
                                                              Stretch="Fill"
                                                              Stroke="White" />
                                                        <Rectangle Margin="0,2.22,2.079,0"
                                                                   Stroke="White" />
                                                    </Grid>
                                                </Button>
                                                <Button x:Name="Maximize"
                                                        Command="{Binding Source={x:Static SystemCommands.MaximizeWindowCommand}}"
                                                        ToolTip="maximize"
                                                        IsTabStop="False"
                                                        Style="{StaticResource but_title}">
                                                    <Rectangle HorizontalAlignment="Center"
                                                               Height="10"
                                                               Stroke="White"
                                                               VerticalAlignment="Center"
                                                               Width="10" />
                                                </Button>
                                            </Grid>
                                            <Button Command="{Binding Source={x:Static SystemCommands.CloseWindowCommand}}"
                                                    ToolTip="close"
                                                    Style="{StaticResource but_title}"
                                                    IsTabStop="False"
                                                    Width="40">
                                                <Grid HorizontalAlignment="Center"
                                                      Height="10"
                                                      VerticalAlignment="Center"
                                                      Width="10">
                                                    <Path Data="M-130,94.333333 L-110.64082,113.69251"
                                                          Stretch="Fill"
                                                          Stroke="White" />
                                                    <Path Data="M-130,94.333333 L-110.64082,113.69251"
                                                          Stretch="Fill"
                                                          Stroke="White"
                                                          RenderTransformOrigin="0.5,0.5"
                                                          Width="Auto">
                                                        <Path.RenderTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform />
                                                                <SkewTransform />
                                                                <RotateTransform Angle="-90" />
                                                                <TranslateTransform />
                                                            </TransformGroup>
                                                        </Path.RenderTransform>
                                                    </Path>
                                                </Grid>
                                            </Button>-->

                                        </StackPanel>

                                        <Grid Grid.Row="2">
                                            <Path x:Name="ResizeGrip"
                                                  Visibility="Collapsed"
                                                  Width="12"
                                                  Height="12"
                                                  Margin="1"
                                                  HorizontalAlignment="Right"
                                                  Stroke="{StaticResource BlueColorBrush}"
                                                  StrokeThickness="1"
                                                  Stretch="None"
                                                  Data="F1 M1,10 L3,10 M5,10 L7,10 M9,10 L11,10 M2,9 L2,11 M6,9 L6,11 M10,9 L10,11 M5,6 L7,6 M9,6 L11,6 M6,5 L6,7 M10,5 L10,7 M9,2 L11,2 M10,1 L10,3" />
                                        </Grid>
                                    </Grid>
                                </AdornerDecorator>
                            </Border>

                            <!--未選中的顏色-->
                            <!--<Border BorderThickness="1.3"
                                    BorderBrush="#FF006A86"></Border>-->

                            <!--選中的顏色-->
                            <!--<Border BorderBrush="{DynamicResource BlueColorBrush}"
                                    BorderThickness="1.3"
                                    Visibility="{Binding IsActive, 
                                                        Converter={StaticResource bool2VisibilityConverter},
                                                        RelativeSource={RelativeSource FindAncestor, 
                                                        AncestorType={x:Type Window}}}" />-->


                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="WindowState"
                                 Value="Maximized">
                            <!--<Setter TargetName="Maximize"
                                    Property="Visibility"
                                    Value="Collapsed" />
                            <Setter TargetName="Restore"
                                    Property="Visibility"
                                    Value="Visible" />-->

                            <Setter TargetName="LayoutRoot"
                                    Property="Margin"
                                    Value="7" />
                            <!--<Setter TargetName="WindowBorder"
                                    Property="Width"
                                    Value="1600" />-->

                        </Trigger>
                        <Trigger Property="WindowState"
                                 Value="Normal">
                            <!--<Setter TargetName="Maximize"
                                    Property="Visibility"
                                    Value="Visible" />
                            <Setter TargetName="Restore"
                                    Property="Visibility"
                                    Value="Collapsed" />-->
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="ResizeMode"
                                           Value="CanResizeWithGrip" />
                                <Condition Property="WindowState"
                                           Value="Normal" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ResizeGrip"
                                    Property="Visibility"
                                    Value="Visible" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="WindowChrome.WindowChrome">
            <Setter.Value>

                <!--<WindowChrome CornerRadius="0"
                              GlassFrameThickness="1"
                              UseAeroCaptionButtons="True"
                              ResizeBorderThickness="8"
                              CaptionHeight="0"
                              NonClientFrameEdges="None" />-->
                <WindowChrome CornerRadius="0"
                              ResizeBorderThickness="8,6,7,8"
                              CaptionHeight="0"
                              GlassFrameThickness="{Binding BorderThickness, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}"
                              UseAeroCaptionButtons="True"
                              NonClientFrameEdges="None" />
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>