<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:styleableWindow="clr-namespace:WpfStyleableWindow.StyleableWindow;assembly=MECF.Framework.Common">

    <!--  主窗口背景色  -->
    <!--<Style TargetType="Window" x:Key="mainBackground">
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/主界面_切片.png" />
            </Setter.Value>
        </Setter>
    </Style>-->
    <ImageBrush x:Key="mainBackgroundImg" ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/主界面_切片SORTER.png" />
    <ImageBrush x:Key="loginBackgroundImg" ImageSource="pack://application:,,,/MECF.Framework.Common;component/Resources/Main/login.png" />

    <!--  背景颜色  -->
    <!--<SolidColorBrush Color="#1E7FC3" x:Key="mainBackgroundColor" />-->

    <SolidColorBrush x:Key="mainBackgroundColor" Color="#FF0671BC" />
    <SolidColorBrush x:Key="mainInnerBackgroundColor" Color="#FFA4E1F8" />

    <SolidColorBrush x:Key="mainCenterBackgroundColor" Color="#FFDDECF9" />

    <SolidColorBrush x:Key="viewBackgroundColor" Color="#669ACC" />

    <!--<SolidColorBrush Color="#548C9B" x:Key="mainBackgroundColor" />

    <SolidColorBrush Color="#548C9B" x:Key="viewBackgroundColor" />-->

    <!--<SolidColorBrush Color="LightBlue" x:Key="titleBackgroundColor"/>   //  427F7D  afd5d5 -->

    <!--  the brushes used in the template (use these to customize the window look along with the window style (see the bottom of this file)  -->
    <SolidColorBrush x:Key="WindowColor" Color="Red" />
    <SolidColorBrush x:Key="WindowBackColor" Color="LightBlue" />
    <SolidColorBrush x:Key="WindowForeColor" Color="WhiteSmoke" />
    <SolidColorBrush x:Key="WindowForeHighlightColor" Color="WhiteSmoke" />
    <SolidColorBrush x:Key="WindowButtonColor" Color="DodgerBlue" />
    <SolidColorBrush x:Key="WindowButtonOverColor" Color="LightBlue" />
    <SolidColorBrush x:Key="WindowButtonPressedColor" Color="DarkBlue" />

    <!--  BottomView Style  -->
    <SolidColorBrush x:Key="BtmnavButton_FG" Color="#FF004294" />

    <SolidColorBrush x:Key="BottomFrame_BG" Color="#FF0C206C" />

    <!--  -red window brushes  -->
    <!--<SolidColorBrush x:Key="WindowColor" Color="DarkRed"/>
        <SolidColorBrush x:Key="WindowBackColor" Color="DarkRed"/>
        <SolidColorBrush x:Key="WindowForeColor" Color="White"/>
        <SolidColorBrush x:Key="WindowForeHighlightColor" Color="White"/>
        <SolidColorBrush x:Key="WindowButtonColor" Color="OrangeRed"/>
        <SolidColorBrush x:Key="WindowButtonOverColor" Color="Orange"/>
        <SolidColorBrush x:Key="WindowButtonPressedColor" Color="DarkOrange"/>-->

    <!--  The window template and it's components  -->

    <styleableWindow:WindowMinimizeCommand x:Key="MinimizeCommand" />
    <styleableWindow:WindowMaximizeCommand x:Key="MaximizeCommand" />
    <styleableWindow:WindowCloseCommand x:Key="CloseCommand" />

    <Style x:Key="WindowButton" TargetType="{x:Type Button}">
        <Setter Property="Height" Value="25" />
        <Setter Property="Width" Value="25" />
        <Setter Property="Background" Value="{StaticResource WindowButtonColor}" />
        <Setter Property="Foreground" Value="{StaticResource WindowForeColor}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource WindowButtonColor}" />
                            <Setter Property="Foreground" Value="{StaticResource WindowColor}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource WindowButtonOverColor}" />
                            <Setter Property="Foreground" Value="{StaticResource WindowForeHighlightColor}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{StaticResource WindowButtonPressedColor}" />
                            <Setter Property="Foreground" Value="{StaticResource WindowForeColor}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="WindowIcon" TargetType="{x:Type Image}">
        <Setter Property="Height" Value="25" />
        <Setter Property="Width" Value="25" />
    </Style>

    <ControlTemplate x:Key="WindowTemplate" TargetType="{x:Type Window}">
        <Grid Background="{StaticResource WindowBackColor}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" Margin="5,0,5,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="75" />
                    </Grid.ColumnDefinitions>
                    <Label
                        Grid.Column="0"
                        Padding="0"
                        styleableWindow:ControlDoubleClickBehavior.ExecuteCommand="{StaticResource CloseCommand}"
                        styleableWindow:ControlDoubleClickBehavior.ExecuteCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}">
                        <Image
                            Width="16"
                            styleableWindow:ShowSystemMenuBehavior.LeftButtonShowAt="{Binding ElementName=WindowContent}"
                            styleableWindow:ShowSystemMenuBehavior.TargetWindow="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                            DockPanel.Dock="Left"
                            Source="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=Icon}"
                            Style="{StaticResource WindowIcon}" />
                    </Label>
                    <Label
                        Grid.Column="1"
                        Padding="3,0,0,0"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        HorizontalContentAlignment="Center"
                        VerticalContentAlignment="Center"
                        styleableWindow:ControlDoubleClickBehavior.ExecuteCommand="{StaticResource MaximizeCommand}"
                        styleableWindow:ControlDoubleClickBehavior.ExecuteCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                        styleableWindow:ShowSystemMenuBehavior.RightButtonShow="true"
                        styleableWindow:ShowSystemMenuBehavior.TargetWindow="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                        styleableWindow:WindowDragBehavior.LeftMouseButtonDrag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                        Content="{TemplateBinding Property=Title}"
                        DockPanel.Dock="Left"
                        FontSize="16"
                        Foreground="{StaticResource WindowForeColor}" />
                    <StackPanel Grid.Column="2" Orientation="Horizontal">
                        <Button
                            Command="{StaticResource MinimizeCommand}"
                            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                            DockPanel.Dock="Right"
                            Style="{StaticResource WindowButton}">
                            _
                        </Button>
                        <Button
                            Command="{StaticResource MaximizeCommand}"
                            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                            DockPanel.Dock="Right"
                            Style="{StaticResource WindowButton}">
                            +
                        </Button>
                        <Button
                            Command="{StaticResource CloseCommand}"
                            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                            DockPanel.Dock="Right"
                            Style="{StaticResource WindowButton}">
                            X
                        </Button>
                    </StackPanel>
                </Grid>
                <Border
                    Grid.Row="1"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
                    <Grid>
                        <AdornerDecorator>
                            <ContentPresenter x:Name="WindowContent" />
                        </AdornerDecorator>
                        <ResizeGrip
                            x:Name="WindowResizeGrip"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Bottom"
                            IsTabStop="false"
                            Visibility="Collapsed" />
                    </Grid>
                </Border>
            </Grid>
            <Thumb
                x:Name="ThumbTop"
                Height="6"
                Margin="14,0"
                VerticalAlignment="Top"
                styleableWindow:WindowResizeBehavior.TopResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNS"
                Opacity="0" />
            <Thumb
                x:Name="ThumbTopLeft"
                Width="6"
                Height="6"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                styleableWindow:WindowResizeBehavior.TopLeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNWSE"
                Opacity="0" />
            <Thumb
                x:Name="ThumbBottom"
                Height="6"
                Margin="14,0"
                VerticalAlignment="Bottom"
                styleableWindow:WindowResizeBehavior.BottomResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNS"
                Opacity="0" />
            <Thumb
                x:Name="ThumbTopRight"
                Width="6"
                Height="6"
                HorizontalAlignment="Right"
                VerticalAlignment="Top"
                styleableWindow:WindowResizeBehavior.TopRightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNESW"
                Opacity="0" />
            <Thumb
                x:Name="ThumbRight"
                Width="6"
                Margin="0,14"
                HorizontalAlignment="Right"
                styleableWindow:WindowResizeBehavior.RightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeWE"
                Opacity="0" />
            <Thumb
                x:Name="ThumbBottomRight"
                Width="6"
                Height="6"
                HorizontalAlignment="Right"
                VerticalAlignment="Bottom"
                styleableWindow:WindowResizeBehavior.BottomRightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNWSE"
                Opacity="0" />
            <Thumb
                x:Name="ThumbLeft"
                Width="6"
                Margin="0,14"
                HorizontalAlignment="Left"
                styleableWindow:WindowResizeBehavior.LeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeWE"
                Opacity="0" />
            <Thumb
                x:Name="ThumbBottomLeft"
                Width="6"
                Height="6"
                HorizontalAlignment="Left"
                VerticalAlignment="Bottom"
                styleableWindow:WindowResizeBehavior.BottomLeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
                Cursor="SizeNESW"
                Opacity="0" />
        </Grid>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="ResizeMode" Value="CanResizeWithGrip" />
                    <Condition Property="WindowState" Value="Normal" />
                </MultiTrigger.Conditions>
                <Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--
        the custom window style and the window template
        Here you can customize the look of the window without having to touch the control template
        or comment out the brushes and create a new style (see the red style below)
    -->

    <Style x:Key="CustomWindowStyle" TargetType="{x:Type Window}">
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="AllowsTransparency" Value="True" />
        <Setter Property="MinWidth" Value="200" />
        <Setter Property="MinHeight" Value="46" />
        <!--  CaptionHeight + ResizeBorderThickness * 2  -->
        <Setter Property="Background" Value="LightGray" />
        <Setter Property="BorderBrush" Value="DodgerBlue" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Foreground" Value="Black" />

        <Setter Property="Template" Value="{StaticResource WindowTemplate}" />

    </Style>

    <!--  the red style window  -->
    <Style x:Key="RedWindowStyle" TargetType="{x:Type Window}">
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="AllowsTransparency" Value="True" />
        <Setter Property="MinWidth" Value="100" />
        <Setter Property="MinHeight" Value="46" />
        <Setter Property="Background" Value="white" />
        <Setter Property="BorderBrush" Value="DarkRed" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Foreground" Value="DarkGray" />
        <Setter Property="Template" Value="{StaticResource WindowTemplate}" />
    </Style>

</ResourceDictionary>


