<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:darkBlendTheme="clr-namespace:DarkBlendTheme"
    xmlns:local="clr-namespace:Wabbajack"
    xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <!--  Converters  -->
    <local:BoolToVisibilityConverter x:Key="bool2VisibilityConverter" />
    <local:BoolToVisibilityHiddenConverter x:Key="bool2VisibilityHiddenConverter" />
    <local:InverseBooleanConverter x:Key="InverseBooleanConverter" />
    <local:IsNotNullVisibilityConverter x:Key="IsNotNullVisibilityConverter" />
    <local:EqualsToBoolConverter x:Key="EqualsToBoolConverter" />

    <!--  Colors  -->
    <Color x:Key="WindowBackgroundColor">#121212</Color>
    <Color x:Key="DarkBackgroundColor">#292929</Color>
    <Color x:Key="LightBackgroundColor">#414141</Color>
    <Color x:Key="BackgroundColor">#3D3D3D</Color>
    <Color x:Key="DisabledBackgroundColor">#424242</Color>
    <Color x:Key="PressedBackgroundColor">#394140</Color>
    <Color x:Key="LightDisabledBackgroundColor">#666666</Color>

    <Color x:Key="ForegroundColor">#EFEFEF</Color>

    <Color x:Key="HighlightColor">#BDBDBD</Color>
    <Color x:Key="HotColor">#525252</Color>

    <Color x:Key="Yellow">#ffc400</Color>
    <Color x:Key="Red">#e83a40</Color>
    <Color x:Key="Green">#52b545</Color>

    <Color x:Key="Primary">#BB86FC</Color>
    <Color x:Key="PrimaryVariant">#3700B3</Color>
    <Color x:Key="Secondary">#03DAC6</Color>
    <Color x:Key="DarkSecondary">#0e8f83</Color>
    <Color x:Key="Complementary">#C7FC86</Color>
    <Color x:Key="Analogous1">#868CFC</Color>
    <Color x:Key="Analogous2">#F686FC</Color>
    <Color x:Key="Triadic1">#FC86C7</Color>
    <Color x:Key="Triadic2">#FCBB86</Color>

    <!--  Brushes  -->
    <SolidColorBrush x:Key="YellowBrush" Color="{StaticResource Yellow}" />
    <SolidColorBrush x:Key="GreenBrush" Color="{StaticResource Green}" />
    <SolidColorBrush x:Key="RedBrush" Color="{StaticResource Red}" />
    <SolidColorBrush x:Key="WarningBrush" Color="{StaticResource Yellow}" />
    <SolidColorBrush x:Key="ErrorBrush" Color="{StaticResource Red}" />

    <SolidColorBrush x:Key="DarkBackgroundBrush" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="LightBackgroundBrush" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="BackgroundBrush" Color="{StaticResource BackgroundColor}" />
    <SolidColorBrush x:Key="ForegroundBrush" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="MouseOverForegroundBrush" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="WindowBackgroundBrush" Color="{StaticResource WindowBackgroundColor}" />

    <SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}" />
    <SolidColorBrush x:Key="PrimaryVariantBrush" Color="{StaticResource PrimaryVariant}" />
    <SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}" />
    <SolidColorBrush x:Key="DarkSecondaryBrush" Color="{StaticResource DarkSecondary}" />
    <SolidColorBrush x:Key="ComplementaryBrush" Color="{StaticResource Complementary}" />
    <SolidColorBrush x:Key="Analogous1Brush" Color="{StaticResource Analogous1}" />
    <SolidColorBrush x:Key="Analogous2Brush" Color="{StaticResource Analogous2}" />
    <SolidColorBrush x:Key="Triadic1Brush" Color="{StaticResource Triadic1}" />
    <SolidColorBrush x:Key="Triadic2Brush" Color="{StaticResource Triadic2}" />

    <SolidColorBrush x:Key="TabControlNormalBorderBrush" Color="{StaticResource WindowBackgroundColor}" />

    <SolidColorBrush x:Key="TabItemHotBackground" Color="{StaticResource HotColor}" />
    <SolidColorBrush x:Key="TabItemSelectedBackground" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="TabItemHotBorderBrush" Color="{StaticResource HotColor}" />
    <SolidColorBrush x:Key="TabItemDisabledBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="TabItemDisabledBorderBrush" Color="{StaticResource DarkBackgroundColor}" />

    <SolidColorBrush x:Key="ScrollViewerBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="VerticalScrollBarBackground" Color="{StaticResource BackgroundColor}" />
    <SolidColorBrush x:Key="HorizontalScrollBarBackground" Color="{StaticResource BackgroundColor}" />
    <SolidColorBrush x:Key="VerticalScrollBarThumb" Color="#808080" />
    <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="{StaticResource BackgroundColor}" />
    <SolidColorBrush x:Key="ScrollBarHotThumb" Color="#CCCCCC" />
    <SolidColorBrush x:Key="ScrollBarSelectedThumb" Color="#E5E5E5" />
    <SolidColorBrush x:Key="CornerBorder" Color="{StaticResource DarkBackgroundColor}" />

    <SolidColorBrush x:Key="TextBoxBorder" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="TextBoxBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="TextBoxDisabledForeground" Color="#8C8C8C" />
    <SolidColorBrush x:Key="TextBoxDisabledBackground" Color="{StaticResource DisabledBackgroundColor}" />
    <SolidColorBrush x:Key="InactiveSelectionHighlightBrush" Color="#335C85" />

    <SolidColorBrush x:Key="ComboBoxButtonNormalBackground" Color="#808080" />

    <SolidColorBrush x:Key="ButtonNormalBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="ButtonNormalBorder" Color="#4C4C4C" />

    <SolidColorBrush x:Key="ButtonForeground" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="MouseOverButtonForeground" Color="White" />
    <SolidColorBrush x:Key="ButtonBackground" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="ButtonBorder" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="PressedButtonBackground" Color="{StaticResource PressedBackgroundColor}" />
    <SolidColorBrush x:Key="MouseOverButtonBackground" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="DisabledButtonBackground" Color="{StaticResource LightDisabledBackgroundColor}" />
    <SolidColorBrush x:Key="DisabledButtonForeground" Color="{StaticResource DisabledBackgroundColor}" />

    <SolidColorBrush x:Key="Expander.Background" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="Expander.Disabled.Arrow.Stroke" Color="{StaticResource LightDisabledBackgroundColor}" />
    <SolidColorBrush x:Key="Expander.Static.Arrow.Stroke" Color="#AAAAAA" />

    <SolidColorBrush x:Key="CheckBoxFillNormal" Color="{StaticResource LightDisabledBackgroundColor}" />
    <SolidColorBrush x:Key="CheckBoxMouseOverStroke" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="CheckBoxDisabledStroke" Color="{StaticResource DisabledBackgroundColor}" />
    <SolidColorBrush x:Key="CheckBoxDisabledForeground" Color="#939393" />
    <SolidColorBrush x:Key="CheckBoxStroke" Color="{StaticResource DarkBackgroundColor}" />

    <SolidColorBrush x:Key="RadioButtonMouseOverStroke" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="RadioButtonDisabledStroke" Color="{StaticResource DisabledBackgroundColor}" />
    <SolidColorBrush x:Key="RadioButtonDisabledForeground" Color="#939393" />
    <SolidColorBrush x:Key="RadioButtonStroke" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="RadioButtonForeground" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="RadioButtonBackground" Color="{StaticResource LightDisabledBackgroundColor}" />

    <SolidColorBrush x:Key="ListBorder" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="ListBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="SelectedListItem" Color="{StaticResource HighlightColor}" />
    <SolidColorBrush x:Key="SelectedListItemForeground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="MouseOverListItem" Color="#4A4A4A" />

    <SolidColorBrush x:Key="TreeViewBackground" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="TreeViewDisabledForeground" Color="{StaticResource LightDisabledBackgroundColor}" />

    <SolidColorBrush x:Key="DisabledMenuForeground" Color="#656565" />
    <SolidColorBrush x:Key="MenuBackground" Color="#3A3A3A" />
    <SolidColorBrush x:Key="MenuItemSelectionFill" Color="{StaticResource HighlightColor}" />
    <SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="#3A3A3A" />
    <SolidColorBrush x:Key="MenuItemPressedFill" Color="{StaticResource HighlightColor}" />
    <SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource LightBackgroundColor}" />
    <SolidColorBrush x:Key="SubMenuRepeatButtonBrush" Color="{StaticResource HotColor}" />
    <SolidColorBrush x:Key="SubMenuHoverRepeatButtonBrush" Color="#7F7F7F" />
    <SolidColorBrush x:Key="MenuSeparatorBrush" Color="#4C4C4C" />

    <SolidColorBrush x:Key="DataGridBackgroundBrush" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="DataGridHeaderBackgroundBrush" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="DataGridHeaderMouseOverBrush" Color="#AAAAAA" />
    <SolidColorBrush x:Key="DataGridHeaderBorderBrush" Color="{StaticResource DisabledBackgroundColor}" />
    <SolidColorBrush x:Key="DataGridRowBorderBrush" Color="{StaticResource DisabledBackgroundColor}" />
    <SolidColorBrush x:Key="DataGridRowBackgroundBrush" Color="{StaticResource DarkBackgroundColor}" />
    <SolidColorBrush x:Key="DataGridRowSelectedBrush" Color="{StaticResource HighlightColor}" />
    <SolidColorBrush x:Key="GridLinesBrush" Color="Transparent" />
    <SolidColorBrush x:Key="{x:Static DataGrid.FocusBorderBrushKey}" Color="Red" />

    <Geometry x:Key="MenuScrollDownArrowGeometry">M-0.7,5.2 L-2.2,6.7 3.6,12.6 9.5,6.7 8,5.2 3.6,9.6 z</Geometry>
    <Geometry x:Key="MenuScrollUpArrowGeometry">M-2.2,10.9 L-0.7,12.4 3.7,8 8,12.4 9.5,10.9 3.7,5 z</Geometry>
    <Geometry x:Key="Checkmark">M1.0E-41,4.2 L0,2.1 2.5,4.5 6.7,4.4E-47 6.7,2.3 2.5,6.7 z</Geometry>
    <Geometry x:Key="CheckBoxCheckmark">M7.2,5 L5.5,7.16 4.16,6.3 3.5,6.7 5.5,8.4 8.6,5.25 C8.6,5.25 8,4.7 7.22,5</Geometry>
    <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
    <Geometry x:Key="ExpanderNormalArrow">M 1,1.5 L 4.5,5 L 8,1.5</Geometry>
    <Geometry x:Key="ExpanderCheckedArrow">M 1,4.5  L 4.5,1  L 8,4.5</Geometry>
    <Geometry x:Key="TabItemRoundedCorner">M6.5,2.6C4.767,0.973 2.509,0 0,0 0,0 0,19 0,19L23,19z</Geometry>
    <Geometry x:Key="RepeatButton">M3.5445026,0 L7.0890052,7.0890053 L3.0459049E-09,7.0890053 z</Geometry>
    <Geometry x:Key="ComboBoxArrow">M-0,6 L-0,8 8,8 8,-0 6,-0 6,6 z</Geometry>
    <Geometry x:Key="ExpanderToggleButtonArrow">M5,-0 L9,5 1,5 z</Geometry>


    <!--  FontStyle  -->
    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="FontFamily" Value="Calibri light" />
        <!--<Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>-->
    </Style>
    <Style TargetType="{x:Type Control}">
        <Setter Property="FontFamily" Value="Calibri light" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
    </Style>
    <Style TargetType="{x:Type Window}">
        <Setter Property="FontFamily" Value="Calibri light" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
    </Style>
    <!--  Necessary for Blend designer for UserControls  -->
    <Style TargetType="{x:Type UserControl}">
        <Setter Property="FontFamily" Value="Calibri light" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
    </Style>


    <!--  TabControl  -->
    <Style TargetType="{x:Type TabControl}">
        <Style.Resources>
            <Style x:Key="BottomStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="-1" />
                            <SkewTransform AngleX="0" AngleY="0" />
                            <RotateTransform Angle="0" />
                            <TranslateTransform />
                        </TransformGroup>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="RightStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="90" />
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="RoundedCornerLeftStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="-90" />
                    </Setter.Value>
                </Setter>
                <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <ScaleTransform ScaleY="-1" />
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="LeftStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="-90" />
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="DefaultStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="0" />
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="TabItemFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Rectangle
                                Margin="3,3,3,1"
                                SnapsToDevicePixels="true"
                                Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                                StrokeDashArray="1 2"
                                StrokeThickness="1" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type TabItem}">
                <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
                <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
                <Setter Property="Padding" Value="6,1,6,1" />
                <Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}" />
                <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid x:Name="Container">
                                <Grid
                                    x:Name="Grid"
                                    Margin="1,0,-12,0"
                                    SnapsToDevicePixels="true">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Border
                                        x:Name="Bd"
                                        Grid.Column="0"
                                        Padding="{TemplateBinding Padding}"
                                        Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="0"
                                        CornerRadius="3,0,0,0">
                                        <ContentPresenter
                                            x:Name="Content"
                                            Margin="6,1,6,1"
                                            HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
                                            VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
                                            ContentSource="Header"
                                            RecognizesAccessKey="True"
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                    </Border>
                                    <Path
                                        x:Name="RoundedCorner"
                                        Grid.Row="0"
                                        Grid.Column="1"
                                        Width="24"
                                        Data="{StaticResource TabItemRoundedCorner}"
                                        Fill="{TemplateBinding Background}"
                                        Stretch="Fill" />
                                </Grid>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="Bd" Property="Background" Value="{StaticResource TabItemHotBackground}" />
                                    <Setter TargetName="RoundedCorner" Property="Fill" Value="{StaticResource TabItemHotBackground}" />
                                </Trigger>
                                <Trigger Property="IsSelected" Value="true">
                                    <Setter Property="Panel.ZIndex" Value="1" />
                                    <Setter TargetName="Bd" Property="Background" Value="{StaticResource TabItemSelectedBackground}" />
                                    <Setter TargetName="RoundedCorner" Property="Fill" Value="{StaticResource TabItemSelectedBackground}" />
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="false" />
                                        <Condition Property="IsMouseOver" Value="true" />
                                    </MultiTrigger.Conditions>
                                    <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource TabItemHotBorderBrush}" />
                                    <Setter TargetName="RoundedCorner" Property="Fill" Value="{StaticResource TabItemHotBorderBrush}" />
                                </MultiTrigger>
                                <Trigger Property="TabStripPlacement" Value="Bottom">
                                    <!--<Setter Property="BorderThickness" TargetName="Bd" Value="1,0,1,1"/>-->
                                    <Setter TargetName="RoundedCorner" Property="Style" Value="{StaticResource BottomStyle}" />
                                    <Setter TargetName="Bd" Property="Style" Value="{StaticResource BottomStyle}" />
                                    <Setter TargetName="Content" Property="Style" Value="{StaticResource BottomStyle}" />
                                </Trigger>
                                <Trigger Property="TabStripPlacement" Value="Left">
                                    <!--<Setter Property="BorderThickness" TargetName="Bd" Value="1,1,0,1"/>-->
                                    <Setter TargetName="Bd" Property="Grid.Row" Value="0" />
                                    <Setter TargetName="Bd" Property="Grid.Column" Value="0" />
                                    <Setter TargetName="RoundedCorner" Property="Grid.Row" Value="1" />
                                    <Setter TargetName="RoundedCorner" Property="Grid.Column" Value="0" />
                                    <Setter TargetName="RoundedCorner" Property="Style" Value="{StaticResource RoundedCornerLeftStyle}" />
                                    <Setter TargetName="Bd" Property="Style" Value="{StaticResource LeftStyle}" />
                                    <Setter TargetName="Content" Property="Style" Value="{StaticResource DefaultStyle}" />
                                    <Setter TargetName="Grid" Property="Margin" Value="0,1,0,-16" />
                                    <Setter TargetName="Bd" Property="CornerRadius" Value="0 3 0 0" />
                                    <Setter TargetName="RoundedCorner" Property="Margin" Value="0,4,0,0" />
                                </Trigger>
                                <Trigger Property="TabStripPlacement" Value="Right">
                                    <!--<Setter Property="BorderThickness" TargetName="Bd" Value="0,1,1,1"/>-->
                                    <Setter TargetName="Bd" Property="Grid.Row" Value="0" />
                                    <Setter TargetName="Bd" Property="Grid.Column" Value="1" />
                                    <Setter TargetName="RoundedCorner" Property="Grid.Row" Value="1" />
                                    <Setter TargetName="RoundedCorner" Property="Grid.Column" Value="1" />
                                    <Setter TargetName="RoundedCorner" Property="Style" Value="{StaticResource RightStyle}" />
                                    <Setter TargetName="Bd" Property="Style" Value="{StaticResource RightStyle}" />
                                    <Setter TargetName="Content" Property="Style" Value="{StaticResource DefaultStyle}" />
                                    <Setter TargetName="Grid" Property="Margin" Value="0,1,0,-12" />
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="true" />
                                        <Condition Property="TabStripPlacement" Value="Top" />
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Margin" Value="0,0,0,-1" />
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="true" />
                                        <Condition Property="TabStripPlacement" Value="Bottom" />
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Margin" Value="0,-1,0,0" />
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="true" />
                                        <Condition Property="TabStripPlacement" Value="Left" />
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Margin" Value="0,0,-1,0" />
                                </MultiTrigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="true" />
                                        <Condition Property="TabStripPlacement" Value="Right" />
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Margin" Value="-1,0,0,0" />
                                </MultiTrigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter TargetName="Bd" Property="Background" Value="{StaticResource TabItemDisabledBackground}" />
                                    <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource TabItemDisabledBorderBrush}" />
                                    <Setter TargetName="RoundedCorner" Property="Fill" Value="{StaticResource TabItemDisabledBackground}" />
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <!--<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>-->
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Padding" Value="4" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}" />
        <Setter Property="Background" Value="{DynamicResource TabItemSelectedBackground}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid
                        ClipToBounds="true"
                        KeyboardNavigation.TabNavigation="Local"
                        SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0" />
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto" />
                            <RowDefinition x:Name="RowDefinition1" Height="*" />
                        </Grid.RowDefinitions>
                        <TabPanel
                            x:Name="HeaderPanel"
                            Grid.Row="0"
                            Grid.Column="0"
                            Panel.ZIndex="1"
                            IsItemsHost="true"
                            KeyboardNavigation.TabIndex="1" />
                        <Border
                            x:Name="ContentPanel"
                            Grid.Row="1"
                            Grid.Column="0"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            KeyboardNavigation.DirectionalNavigation="Contained"
                            KeyboardNavigation.TabIndex="2"
                            KeyboardNavigation.TabNavigation="Local">
                            <ContentPresenter
                                x:Name="PART_SelectedContentHost"
                                Margin="{TemplateBinding Padding}"
                                ContentSource="SelectedContent"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
                            <!--<Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>-->
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
                            <!--<Setter Property="Margin" TargetName="HeaderPanel" Value="2,2,0,2"/>-->
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
                            <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
                            <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
                            <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
                            <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
                            <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
                            <!--<Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>-->
                            <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />

                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--  ScrollBar  -->
    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="Background" Value="{DynamicResource ScrollViewerBackground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid x:Name="Grid" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Rectangle
                            x:Name="Corner"
                            Grid.Row="1"
                            Grid.Column="1"
                            Fill="{TemplateBinding Background}" />
                        <ScrollContentPresenter
                            x:Name="PART_ScrollContentPresenter"
                            Grid.Row="0"
                            Grid.Column="0"
                            Margin="{TemplateBinding Padding}"
                            CanContentScroll="{TemplateBinding CanContentScroll}"
                            CanHorizontallyScroll="False"
                            CanVerticallyScroll="False"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}" />
                        <ScrollBar
                            x:Name="PART_VerticalScrollBar"
                            Grid.Row="0"
                            Grid.Column="1"
                            AutomationProperties.AutomationId="VerticalScrollBar"
                            Cursor="Arrow"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            Minimum="0"
                            Style="{DynamicResource VerticalScrollBarStyle}"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                            Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <ScrollBar
                            x:Name="PART_HorizontalScrollBar"
                            Grid.Row="1"
                            Grid.Column="0"
                            AutomationProperties.AutomationId="HorizontalScrollBar"
                            Cursor="Arrow"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            Minimum="0"
                            Orientation="Horizontal"
                            Style="{DynamicResource HorisontalScrollBarStyle}"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                            Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RepeatButtonUpStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid Background="Transparent">
                        <Path
                            x:Name="TrianglePath"
                            Width="Auto"
                            Height="Auto"
                            Margin="5"
                            Data="{StaticResource RepeatButton}"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            Stretch="Fill" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid>
                        <Rectangle
                            x:Name="VerticalThumb"
                            Width="7.4"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            RadiusX="4"
                            RadiusY="4" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VerticalThumb" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsDragging" Value="True">
                            <Setter TargetName="VerticalThumb" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style
        x:Key="RepeatButtonDownStyle"
        BasedOn="{StaticResource RepeatButtonUpStyle}"
        TargetType="{x:Type RepeatButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid Background="Transparent">
                        <Path
                            x:Name="BottomTrianglePath"
                            Width="Auto"
                            Height="Auto"
                            Margin="5"
                            Data="{StaticResource RepeatButton}"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            RenderTransformOrigin="0.5,0.5"
                            Stretch="Fill">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1" ScaleY="-1" />
                                    <SkewTransform AngleX="0" AngleY="0" />
                                    <RotateTransform Angle="0" />
                                    <TranslateTransform />
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="BottomTrianglePath" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="BottomTrianglePath" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Fill="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Rectangle
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        Fill="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalScrollBarStyle" TargetType="{x:Type ScrollBar}">
        <Setter Property="Background" Value="{StaticResource VerticalScrollBarBackground}" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Grid
                        x:Name="Bg"
                        Background="{TemplateBinding Background}"
                        SnapsToDevicePixels="true">
                        <Grid.RowDefinitions>
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" />
                            <RowDefinition Height="0.00001*" />
                            <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" />
                        </Grid.RowDefinitions>
                        <RepeatButton
                            Command="{x:Static ScrollBar.LineUpCommand}"
                            IsEnabled="{TemplateBinding IsMouseOver}"
                            Style="{StaticResource RepeatButtonUpStyle}" />
                        <Track
                            x:Name="PART_Track"
                            Grid.Row="1"
                            IsDirectionReversed="true"
                            IsEnabled="{TemplateBinding IsMouseOver}">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}" />
                            </Track.DecreaseRepeatButton>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}" />
                            </Track.IncreaseRepeatButton>
                            <Track.Thumb>
                                <Thumb Style="{StaticResource ScrollBarThumb}" />
                            </Track.Thumb>
                        </Track>
                        <RepeatButton
                            Grid.Row="2"
                            Command="{x:Static ScrollBar.LineDownCommand}"
                            IsEnabled="{TemplateBinding IsMouseOver}"
                            Style="{DynamicResource RepeatButtonDownStyle}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="MinWidth" Value="0" />
                <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />
                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />
                <Setter Property="Background" Value="{StaticResource HorizontalScrollBarBackground}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid
                                x:Name="Bg"
                                Background="{TemplateBinding Background}"
                                SnapsToDevicePixels="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                    <ColumnDefinition Width="0.00001*" />
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                </Grid.ColumnDefinitions>
                                <RepeatButton
                                    Command="{x:Static ScrollBar.LineLeftCommand}"
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Style="{StaticResource RepeatButtonUpStyle}" />
                                <Track
                                    x:Name="PART_Track"
                                    Grid.Column="1"
                                    IsEnabled="{TemplateBinding IsMouseOver}">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" />
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" />
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb Style="{StaticResource ScrollBarThumb}" />
                                    </Track.Thumb>
                                </Track>
                                <RepeatButton
                                    Grid.Column="2"
                                    Command="{x:Static ScrollBar.LineRightCommand}"
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Style="{StaticResource RepeatButtonUpStyle}" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="HorisontalScrollBarStyle" TargetType="{x:Type ScrollBar}">
        <Setter Property="Background" Value="{StaticResource VerticalScrollBarBackground}" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="MinWidth" Value="0" />
                <Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />
                <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />
                <Setter Property="Background" Value="{StaticResource HorizontalScrollBarBackground}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid
                                x:Name="Bg"
                                Background="{TemplateBinding Background}"
                                SnapsToDevicePixels="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                    <ColumnDefinition Width="0.00001*" />
                                    <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                </Grid.ColumnDefinitions>
                                <RepeatButton
                                    Command="{x:Static ScrollBar.LineLeftCommand}"
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Style="{DynamicResource RepeatLeftButtonStyle}" />
                                <Track
                                    x:Name="PART_Track"
                                    Grid.Column="1"
                                    IsEnabled="{TemplateBinding IsMouseOver}">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" />
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}" />
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb Style="{DynamicResource HorisontalThumbStyle}" />
                                    </Track.Thumb>
                                </Track>
                                <RepeatButton
                                    Grid.Column="2"
                                    Command="{x:Static ScrollBar.LineRightCommand}"
                                    IsEnabled="{TemplateBinding IsMouseOver}"
                                    Style="{DynamicResource RepeatRightButtonStyle}" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter TargetName="Bg" Property="Background" Value="{StaticResource ScrollBarDisabledBackground}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="HorisontalThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Grid>
                        <Rectangle
                            x:Name="VerticalThumb"
                            Height="7.4"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            RadiusX="4"
                            RadiusY="4" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="VerticalThumb" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsDragging" Value="True">
                            <Setter TargetName="VerticalThumb" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RepeatLeftButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid Background="Transparent" RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform />
                                <SkewTransform />
                                <RotateTransform Angle="270" />
                                <TranslateTransform />
                            </TransformGroup>
                        </Grid.RenderTransform>
                        <Path
                            x:Name="TrianglePath"
                            Width="Auto"
                            Height="Auto"
                            Margin="5"
                            Data="{StaticResource RepeatButton}"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            Stretch="Fill" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="RepeatRightButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid Background="Transparent" RenderTransformOrigin="0.5,0.5">
                        <Grid.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform />
                                <SkewTransform />
                                <RotateTransform Angle="270" />
                                <TranslateTransform />
                            </TransformGroup>
                        </Grid.RenderTransform>
                        <Path
                            x:Name="TrianglePath"
                            Width="Auto"
                            Height="Auto"
                            Margin="5"
                            Data="{StaticResource RepeatButton}"
                            Fill="{StaticResource VerticalScrollBarThumb}"
                            RenderTransformOrigin="0.5,0.5"
                            Stretch="Fill">
                            <Path.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform />
                                    <SkewTransform />
                                    <RotateTransform Angle="180" />
                                    <TranslateTransform />
                                </TransformGroup>
                            </Path.RenderTransform>
                        </Path>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarHotThumb}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="TrianglePath" Property="Fill" Value="{StaticResource ScrollBarSelectedThumb}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  TextBox  -->
    <Style
        x:Key="MainTextBoxStyle"
        BasedOn="{StaticResource {x:Type Control}}"
        TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="3" />
        <Setter Property="AllowDrop" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border
                        x:Name="Bd"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="3"
                        SnapsToDevicePixels="true">
                        <Grid>
                            <ScrollViewer
                                x:Name="PART_ContentHost"
                                Padding="{TemplateBinding Padding}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <TextBlock
                                x:Name="PART_Message"
                                Grid.Row="1"
                                Grid.Column="0"
                                Padding="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Foreground="{TemplateBinding Foreground}"
                                Style="{DynamicResource MahApps.Metro.Styles.MetroWatermarkTextBlock}"
                                Text="{TemplateBinding mahapps:TextBoxHelper.Watermark}"
                                TextAlignment="{TemplateBinding mahapps:TextBoxHelper.WatermarkAlignment}"
                                TextTrimming="{TemplateBinding mahapps:TextBoxHelper.WatermarkTrimming}"
                                TextWrapping="{TemplateBinding mahapps:TextBoxHelper.WatermarkWrapping}"
                                Visibility="Collapsed" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="enterGotFocus">
                            <DoubleAnimation
                                Storyboard.TargetName="PART_Message"
                                Storyboard.TargetProperty="Opacity"
                                To=".2"
                                Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitGotFocus">
                            <DoubleAnimation
                                Storyboard.TargetName="PART_Message"
                                Storyboard.TargetProperty="Opacity"
                                Duration="0:0:0.2" />
                        </Storyboard>

                        <Storyboard x:Key="enterHasText">
                            <DoubleAnimation
                                Storyboard.TargetName="PART_Message"
                                Storyboard.TargetProperty="Opacity"
                                From=".2"
                                To="0"
                                Duration="0:0:0.2" />
                        </Storyboard>
                        <Storyboard x:Key="exitHasText">
                            <DoubleAnimation
                                Storyboard.TargetName="PART_Message"
                                Storyboard.TargetProperty="Opacity"
                                Duration="0:0:0.2" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource TextBoxDisabledForeground}" />
                            <Setter TargetName="PART_ContentHost" Property="Background" Value="{StaticResource TextBoxDisabledBackground}" />
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource TextBoxDisabledBackground}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource TextBoxDisabledBackground}" />
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="mahapps:TextBoxHelper.HasText" Value="False" />
                                <Condition Property="IsFocused" Value="True" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterGotFocus}" />
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitGotFocus}" />
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>

                        <Trigger Property="mahapps:TextBoxHelper.HasText" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource enterHasText}" />
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource exitHasText}" />
                            </Trigger.ExitActions>
                        </Trigger>

                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
                            <Setter TargetName="PART_Message" Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=(Validation.HasError), RelativeSource={RelativeSource self}}" Value="True">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style BasedOn="{StaticResource MainTextBoxStyle}" TargetType="TextBox" />

    <!--  ComboBox  -->
    <Style x:Key="ComboBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="2,2,21,2"
                        SnapsToDevicePixels="true"
                        Stroke="{StaticResource ForegroundBrush}"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="ClickMode" Value="Press" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        CornerRadius="3"
                        SnapsToDevicePixels="true">
                        <Border
                            x:Name="PopUpButton"
                            Width="15"
                            Margin="1"
                            HorizontalAlignment="Right"
                            Background="{DynamicResource ComboBoxButtonNormalBackground}"
                            CornerRadius="3">
                            <Path
                                x:Name="Arrow"
                                Width="5.5"
                                Height="5.5"
                                Margin="0,4,0,7"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Data="{StaticResource ComboBoxArrow}"
                                Fill="{DynamicResource ButtonForeground}"
                                RenderTransformOrigin="0.5,0.5"
                                Stretch="Fill">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform />
                                        <SkewTransform />
                                        <RotateTransform Angle="45" />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="PopUpButton" Property="Background" Value="{DynamicResource MouseOverButtonBackground}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource DisabledButtonForeground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
        <Grid x:Name="Placement" SnapsToDevicePixels="true">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Popup
                x:Name="PART_Popup"
                Grid.ColumnSpan="2"
                Margin="1"
                AllowsTransparency="true"
                IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
                Placement="Bottom"
                PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                <Border
                    x:Name="Shdw"
                    MinWidth="{Binding ActualWidth, ElementName=Placement}"
                    MaxHeight="{TemplateBinding MaxDropDownHeight}"
                    Background="Transparent">
                    <Border
                        x:Name="DropDownBorder"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="1">
                        <ScrollViewer x:Name="DropDownScrollViewer">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas
                                    Width="0"
                                    Height="0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top">
                                    <Rectangle
                                        x:Name="OpaqueRect"
                                        Width="{Binding ActualWidth, ElementName=DropDownBorder}"
                                        Height="{Binding ActualHeight, ElementName=DropDownBorder}"
                                        Fill="{Binding Background, ElementName=DropDownBorder}" />
                                </Canvas>
                                <ItemsPresenter
                                    x:Name="ItemsPresenter"
                                    KeyboardNavigation.DirectionalNavigation="Contained"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Border>
            </Popup>
            <Border
                x:Name="Border"
                Grid.ColumnSpan="2"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding Background}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="3" />
            <TextBox x:Name="PART_EditableTextBox" />
            <ToggleButton
                Grid.Column="1"
                IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                Style="{StaticResource ComboBoxReadonlyToggleButton}" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="false">
                <Setter TargetName="DropDownBorder" Property="Height" Value="95" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource TextBoxDisabledForeground}" />
                <Setter Property="Background" Value="{DynamicResource TextBoxDisabledBackground}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsGrouping" Value="true" />
                    <!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
                </MultiTrigger.Conditions>
                <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
            </MultiTrigger>
            <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
                <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
                <Setter TargetName="Shdw" Property="Background" Value="#71000000" />
            </Trigger>
            <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
                <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
                <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" />
        <Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
        <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}" />
        <Setter Property="Padding" Value="5,3,5,1" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="ItemContainerStyle" Value="{DynamicResource ComboBoxItemStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" MinWidth="18" />
                        </Grid.ColumnDefinitions>
                        <Popup
                            x:Name="PART_Popup"
                            Grid.ColumnSpan="2"
                            Margin="1"
                            AllowsTransparency="true"
                            IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
                            Placement="Bottom"
                            PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                            <Border
                                x:Name="Shdw"
                                MinWidth="{Binding ActualWidth, ElementName=MainGrid}"
                                MaxHeight="{TemplateBinding MaxDropDownHeight}"
                                Background="Transparent">
                                <Border
                                    x:Name="DropDownBorder"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="1">
                                    <ScrollViewer x:Name="DropDownScrollViewer">
                                        <Grid RenderOptions.ClearTypeHint="Enabled">
                                            <Canvas
                                                Width="0"
                                                Height="0"
                                                HorizontalAlignment="Left"
                                                VerticalAlignment="Top">
                                                <Rectangle
                                                    x:Name="OpaqueRect"
                                                    Width="{Binding ActualWidth, ElementName=DropDownBorder}"
                                                    Height="{Binding ActualHeight, ElementName=DropDownBorder}"
                                                    Fill="{Binding Background, ElementName=DropDownBorder}" />
                                            </Canvas>
                                            <ItemsPresenter
                                                x:Name="ItemsPresenter"
                                                KeyboardNavigation.DirectionalNavigation="Contained"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                        </Grid>
                                    </ScrollViewer>
                                </Border>
                            </Border>
                        </Popup>
                        <ToggleButton
                            Grid.ColumnSpan="2"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                            Style="{StaticResource ComboBoxReadonlyToggleButton}" />
                        <ContentPresenter
                            Margin="{TemplateBinding Padding}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Content="{TemplateBinding SelectionBoxItem}"
                            ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                            IsHitTestVisible="false"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
                            <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
                            <Setter TargetName="Shdw" Property="Background" Value="#71000000" />
                        </Trigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="Height" Value="95" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource TextBoxDisabledForeground}" />
                            <Setter Property="Background" Value="{DynamicResource TextBoxDisabledBackground}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsGrouping" Value="true" />
                                <!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
                            </MultiTrigger.Conditions>
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
                        </MultiTrigger>
                        <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
                            <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
                            <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="true">
                <!--<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder2}"/>
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>-->
                <Setter Property="IsTabStop" Value="false" />
                <Setter Property="Padding" Value="3" />
                <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="ComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding" Value="3,0,3,0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border
                        x:Name="Bd"
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedListItem}" />
                            <Setter Property="Foreground" Value="Black" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Button  -->
    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="2"
                        SnapsToDevicePixels="true"
                        Stroke="{StaticResource ForegroundBrush}"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="MainButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="Background" Value="{StaticResource ButtonBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
        <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>
                        <Border
                            Background="{StaticResource SecondaryBrush}"
                            CornerRadius="3"
                            Opacity="0.7">
                            <Border.Effect>
                                <BlurEffect Radius="5" />
                            </Border.Effect>
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Setter Property="Visibility" Value="Hidden" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Value="True">
                                            <Setter Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                        <Border
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="3">
                            <ContentPresenter
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource MouseOverButtonBackground}" />
                            <Setter Property="BorderBrush" Value="{StaticResource DarkSecondaryBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource MouseOverButtonForeground}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="{StaticResource PressedButtonBackground}" />
                            <Setter Property="BorderBrush" Value="{StaticResource SecondaryBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
                            <Setter Property="Background" Value="{StaticResource DisabledButtonBackground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style BasedOn="{StaticResource MainButtonStyle}" TargetType="{x:Type Button}" />

    <Style
        x:Key="CircleButtonStyle"
        BasedOn="{StaticResource MahApps.Metro.Styles.MetroCircleButtonStyle}"
        TargetType="ButtonBase">
        <Setter Property="Focusable" Value="False" />
    </Style>

    <!--  ToggleButton  -->
    <Style TargetType="{x:Type ToggleButton}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
        <Setter Property="Background" Value="{StaticResource ButtonBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="3"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            Margin="{TemplateBinding Padding}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="false" />
                                <Condition Property="IsMouseOver" Value="true" />
                            </MultiTrigger.Conditions>
                        </MultiTrigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource MouseOverButtonBackground}" />
                            <Setter Property="Foreground" Value="{StaticResource MouseOverButtonForeground}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
                            <Setter Property="Background" Value="{StaticResource DisabledButtonBackground}" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Background" Value="{StaticResource PressedButtonBackground}" />
                            <Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Expander  -->


    <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="19" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="-90" />
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Path
                                    x:Name="arrow"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Data="{StaticResource ExpanderNormalArrow}"
                                    SnapsToDevicePixels="false"
                                    Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                    StrokeThickness="2" />
                            </Grid>
                            <ContentPresenter
                                Grid.Row="1"
                                Margin="0,4,0,0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Top"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="{StaticResource ExpanderCheckedArrow}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="19" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="180" />
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Path
                                    x:Name="arrow"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Data="{StaticResource ExpanderNormalArrow}"
                                    SnapsToDevicePixels="false"
                                    Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                    StrokeThickness="2" />
                            </Grid>
                            <ContentPresenter
                                Grid.Column="1"
                                Margin="4,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="{StaticResource ExpanderCheckedArrow}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="19" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="90" />
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Path
                                    x:Name="arrow"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Data="{StaticResource ExpanderNormalArrow}"
                                    SnapsToDevicePixels="false"
                                    Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                    StrokeThickness="2" />
                            </Grid>
                            <ContentPresenter
                                Grid.Row="1"
                                Margin="0,4,0,0"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Top"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="{StaticResource ExpanderCheckedArrow}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderHeaderFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle
                            Margin="0"
                            SnapsToDevicePixels="true"
                            Stroke="Black"
                            StrokeDashArray="1 2"
                            StrokeThickness="1" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="19" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Path
                                x:Name="arrow"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Data="{StaticResource ExpanderNormalArrow}"
                                SnapsToDevicePixels="false"
                                Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                StrokeThickness="2" />
                            <ContentPresenter
                                Grid.Column="1"
                                Margin="4,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="{StaticResource ExpanderCheckedArrow}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
        <Setter Property="FontFamily" Value="Calibri light" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="Background" Value="{StaticResource Expander.Background}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="4"
                        SnapsToDevicePixels="true">
                        <DockPanel>
                            <ToggleButton
                                x:Name="HeaderSite"
                                MinWidth="0"
                                MinHeight="0"
                                Margin="5,1,1,1"
                                Padding="{TemplateBinding Padding}"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                Content="{TemplateBinding Header}"
                                ContentTemplate="{TemplateBinding HeaderTemplate}"
                                ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                DockPanel.Dock="Top"
                                FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
                                FontFamily="{TemplateBinding FontFamily}"
                                FontSize="{TemplateBinding FontSize}"
                                FontStretch="{TemplateBinding FontStretch}"
                                FontStyle="{TemplateBinding FontStyle}"
                                FontWeight="{TemplateBinding FontWeight}"
                                Foreground="{TemplateBinding Foreground}"
                                IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                Style="{DynamicResource ExpanderToggleButtonStyle}" />
                            <ContentPresenter
                                x:Name="ExpandSite"
                                Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                DockPanel.Dock="Bottom"
                                Focusable="false"
                                Visibility="Collapsed" />
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}" />
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="8" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Path
                                x:Name="arrow"
                                Grid.ColumnSpan="2"
                                Width="8"
                                Height="4.5"
                                Margin="2.068,6.27,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Top"
                                Data="{StaticResource ExpanderToggleButtonArrow}"
                                Fill="{StaticResource Expander.Static.Arrow.Stroke}"
                                RenderTransformOrigin="0.5,0.5"
                                Stretch="Fill"
                                Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                StrokeThickness="1">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <RotateTransform Angle="135" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <ContentPresenter
                                Grid.Column="1"
                                Margin="4,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="arrow" Property="Margin" Value="-0.526,4.842,0,0" />
                            <Setter TargetName="arrow" Property="RenderTransform">
                                <Setter.Value>
                                    <TransformGroup>
                                        <RotateTransform Angle="90" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false" />
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  CheckBox  -->


    <Style x:Key="EmptyCheckBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="1"
                        SnapsToDevicePixels="true"
                        Stroke="{StaticResource CheckBoxStroke}"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="CheckRadioFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="14,0,0,0"
                        SnapsToDevicePixels="true"
                        Stroke="{StaticResource CheckBoxStroke}"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource CheckBoxFillNormal}" />
        <Setter Property="BorderBrush" Value="{StaticResource CheckBoxStroke}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource EmptyCheckBoxFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator Background="Transparent" SnapsToDevicePixels="true">
                        <BulletDecorator.Bullet>
                            <Border
                                x:Name="CheckBoxBorder"
                                Width="12"
                                Height="12"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="1">
                                <Path
                                    x:Name="CheckMark"
                                    Width="Auto"
                                    Height="Auto"
                                    Margin="1,1.007,1,1"
                                    Data="{StaticResource CheckBoxCheckmark}"
                                    Fill="{StaticResource ButtonForeground}"
                                    Stretch="Fill" />
                            </Border>
                        </BulletDecorator.Bullet>
                        <ContentPresenter
                            Margin="{TemplateBinding Padding}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}" />
                            <Setter Property="Padding" Value="4,0,0,0" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource CheckBoxDisabledForeground}" />
                            <Setter TargetName="CheckBoxBorder" Property="BorderBrush" Value="{StaticResource CheckBoxDisabledStroke}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="CheckBoxBorder" Property="BorderBrush" Value="{StaticResource CheckBoxMouseOverStroke}" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  RadioButton  -->


    <Style x:Key="RadioFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle
                        Margin="14,0,0,0"
                        SnapsToDevicePixels="true"
                        Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                        StrokeDashArray="1 2"
                        StrokeThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="Foreground" Value="{StaticResource RadioButtonForeground}" />
        <Setter Property="Background" Value="{StaticResource RadioButtonBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource RadioButtonStroke}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <BulletDecorator Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Border
                                x:Name="RadioButtonBorder"
                                Width="12"
                                Height="12"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="6">
                                <Border
                                    x:Name="RadioMark"
                                    Width="6"
                                    Height="6"
                                    Background="{StaticResource RadioButtonForeground}"
                                    BorderBrush="{StaticResource RadioButtonForeground}"
                                    CornerRadius="6" />
                            </Border>
                        </BulletDecorator.Bullet>
                        <ContentPresenter
                            Margin="{TemplateBinding Padding}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            RecognizesAccessKey="True" />
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource RadioFocusVisual}" />
                            <Setter Property="Padding" Value="4,0,0,0" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource RadioButtonDisabledForeground}" />
                            <Setter TargetName="RadioButtonBorder" Property="BorderBrush" Value="{StaticResource RadioButtonDisabledStroke}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="RadioButtonBorder" Property="BorderBrush" Value="{StaticResource RadioButtonMouseOverStroke}" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="RadioMark" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  ListView  -->
    <Style TargetType="{x:Type ListView}">
        <Setter Property="Background" Value="{StaticResource ListBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <Border
                        x:Name="Bd"
                        Padding="1"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsGrouping" Value="true" />
                                <!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
                            </MultiTrigger.Conditions>
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding" Value="2,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border
                        x:Name="Bd"
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedListItem}" />
                            <Setter Property="Foreground" Value="{StaticResource SelectedListItemForeground}" />
                        </Trigger>
                        <!--<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="Selector.IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
							</MultiTrigger>-->
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsSelected" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource MouseOverListItem}" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  Label  -->

    <Style TargetType="{x:Type Label}">
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <Border
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  TreeView  -->

    <Style TargetType="{x:Type TreeView}">
        <Setter Property="Background" Value="{StaticResource TreeViewBackground}" />
        <Setter Property="Padding" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeView}">
                    <Border x:Name="Bd" SnapsToDevicePixels="true">
                        <ScrollViewer
                            x:Name="_tv_scrollviewer_"
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            CanContentScroll="false"
                            Focusable="false"
                            HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource TreeViewDisabledForeground}" />
                        </Trigger>
                        <!--<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
    							<Setter Property="CanContentScroll" TargetName="_tv_scrollviewer_" Value="true"/>
    						</Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <!--<Style.Triggers>
            <Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>-->
    </Style>
    <Style x:Key="TreeViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type TreeViewItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="MinHeight" Value="21" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding" Value="2,4,2,3" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <ControlTemplate.Resources>
                        <darkBlendTheme:LeftMarginMultiplierConverter x:Key="LengthConverter" Length="15" />
                    </ControlTemplate.Resources>
                    <StackPanel>
                        <Border
                            Name="Bd"
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}">
                            <Grid Margin="{Binding Converter={StaticResource LengthConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="15" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <ToggleButton
                                    x:Name="Expander"
                                    Grid.Column="0"
                                    ClickMode="Press"
                                    IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                                    Style="{DynamicResource TreeViewToggleButtonStyle}" />

                                <ContentPresenter
                                    x:Name="PART_Header"
                                    Grid.Column="1"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    ContentSource="Header" />
                            </Grid>
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost" />
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="false">
                            <Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="false" />
                                <Condition Property="Width" Value="Auto" />
                            </MultiTrigger.Conditions>

                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="false" />
                                <Condition Property="Height" Value="Auto" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Header" Property="MinHeight" Value="21" />
                        </MultiTrigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedListItem}" />
                            <Setter Property="Foreground" Value="{StaticResource SelectedListItemForeground}" />
                            <Setter TargetName="Expander" Property="Style" Value="{DynamicResource TreeViewSelectedToggleButtonStyle}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition SourceName="Bd" Property="IsMouseOver" Value="true" />
                                <Condition Property="IsSelected" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource MouseOverListItem}" />
                        </MultiTrigger>
                        <!--<MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="true"/>
                                <Condition Property="IsSelectionActive" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                        </MultiTrigger>-->
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource TreeViewDisabledForeground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TreeViewToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="8" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Path
                                x:Name="arrow"
                                Grid.ColumnSpan="2"
                                Width="8"
                                Height="4.5"
                                Margin="2.068,6.27,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Top"
                                Data="{StaticResource ExpanderToggleButtonArrow}"
                                Fill="{StaticResource Expander.Static.Arrow.Stroke}"
                                RenderTransformOrigin="0.5,0.5"
                                Stretch="Fill"
                                Stroke="{StaticResource Expander.Static.Arrow.Stroke}"
                                StrokeThickness="1">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <RotateTransform Angle="135" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <ContentPresenter
                                Grid.Column="1"
                                Margin="4,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="arrow" Property="Margin" Value="-0.526,4.842,0,0" />
                            <Setter TargetName="arrow" Property="RenderTransform">
                                <Setter.Value>
                                    <TransformGroup>
                                        <RotateTransform Angle="90" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Arrow.Stroke}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Disabled.Arrow.Stroke}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TreeViewSelectedToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="8" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Path
                                x:Name="arrow"
                                Grid.ColumnSpan="2"
                                Width="8"
                                Height="4.5"
                                Margin="2.068,6.27,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Top"
                                Data="{StaticResource ExpanderToggleButtonArrow}"
                                Fill="{StaticResource TreeViewBackground}"
                                RenderTransformOrigin="0.5,0.5"
                                Stretch="Fill"
                                Stroke="{StaticResource TreeViewBackground}"
                                StrokeThickness="1">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <RotateTransform Angle="135" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <ContentPresenter
                                Grid.Column="1"
                                Margin="4,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="false">
                            <Setter TargetName="arrow" Property="Margin" Value="-0.526,4.842,0,0" />
                            <Setter TargetName="arrow" Property="RenderTransform">
                                <Setter.Value>
                                    <TransformGroup>
                                        <RotateTransform Angle="90" />
                                        <TranslateTransform X="0.17819090885901012" Y="0.43019090885900946" />
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="Transparent" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsChecked" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="arrow" Property="Fill" Value="{StaticResource TreeViewBackground}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false" />
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  StatusBar  -->
    <Style TargetType="{x:Type StatusBar}">
        <Setter Property="Margin" Value="1,0,3,0" />
        <Setter Property="Height" Value="18" />
        <Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.StatusFontFamilyKey}}" />
        <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.StatusFontSizeKey}}" />
        <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.StatusFontStyleKey}}" />
        <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.StatusFontWeightKey}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type StatusBar}">
                    <Border
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type StatusBarItem}">
        <Setter Property="Margin" Value="4,0,4,0" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type StatusBarItem}">
                    <ContentPresenter
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource TextBoxDisabledForeground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--  Menu  -->

    <Style TargetType="{x:Type Menu}">
        <Setter Property="Background" Value="{StaticResource MenuBackground}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ContextMenu}">
        <Setter Property="Background" Value="{StaticResource MenuBackground}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border
                        Padding="{TemplateBinding Padding}"
                        Background="{StaticResource SubMenuBackgroundBrush}"
                        BorderBrush="{StaticResource SubMenuBorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="true">
            <Rectangle
                x:Name="Bg"
                Fill="{TemplateBinding Background}"
                Stroke="{TemplateBinding BorderBrush}"
                StrokeThickness="1" />
            <Rectangle x:Name="InnerBorder" Margin="1" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="Auto"
                        MinWidth="14"
                        SharedSizeGroup="MenuItemIconColumnGroup" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition MinWidth="37" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
                    <ColumnDefinition Width="17" />
                </Grid.ColumnDefinitions>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="1"
                    VerticalAlignment="Center"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <Border
                    x:Name="GlyphPanel"
                    Margin="1"
                    BorderBrush="Transparent"
                    Visibility="Hidden">
                    <Path
                        x:Name="Glyph"
                        Width="7.5"
                        Height="7.5"
                        Margin="5,0,0,0"
                        VerticalAlignment="Center"
                        Data="{StaticResource Checkmark}"
                        Fill="{StaticResource ForegroundBrush}"
                        FlowDirection="LeftToRight"
                        Stretch="Fill" />
                </Border>
                <ContentPresenter
                    x:Name="Content"
                    Grid.Column="2"
                    Margin="{TemplateBinding Padding}"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <TextBlock
                    Grid.Column="4"
                    Margin="{TemplateBinding Padding}"
                    Text="{TemplateBinding InputGestureText}" />
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemSelectionFill}" />
                <Setter TargetName="Content" Property="TextBlock.Foreground" Value="{StaticResource MouseOverForegroundBrush}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource MouseOverForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource DisabledMenuForeground}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style
        x:Key="MenuScrollButton"
        BasedOn="{x:Null}"
        TargetType="{x:Type RepeatButton}">
        <Setter Property="ClickMode" Value="Hover" />
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="MinHeight" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <DockPanel
                        x:Name="DPButton"
                        Background="{StaticResource SubMenuRepeatButtonBrush}"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            x:Name="ContentContainer"
                            Margin="2,0,2,5"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center" />
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="DPButton" Property="Background" Value="{StaticResource SubMenuHoverRepeatButtonBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
    <Style
        x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer,
                                     TypeInTargetAssembly={x:Type FrameworkElement}}"
        BasedOn="{x:Null}"
        TargetType="{x:Type ScrollViewer}">
        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
        <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Border Grid.Row="1" Grid.Column="0">
                            <ScrollContentPresenter Margin="{TemplateBinding Padding}" CanContentScroll="{TemplateBinding CanContentScroll}" />
                        </Border>
                        <RepeatButton
                            Grid.Row="0"
                            Grid.Column="0"
                            Command="{x:Static ScrollBar.LineUpCommand}"
                            CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                            Focusable="false"
                            Style="{StaticResource MenuScrollButton}">
                            <RepeatButton.Visibility>
                                <MultiBinding
                                    Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                    ConverterParameter="0"
                                    FallbackValue="Visibility.Collapsed">
                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}" />
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path
                                x:Name="UpArrow"
                                Data="{StaticResource MenuScrollUpArrowGeometry}"
                                Fill="{StaticResource ForegroundBrush}" />
                        </RepeatButton>
                        <RepeatButton
                            Grid.Row="2"
                            Grid.Column="0"
                            Command="{x:Static ScrollBar.LineDownCommand}"
                            CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                            Focusable="false"
                            Style="{StaticResource MenuScrollButton}">
                            <RepeatButton.Visibility>
                                <MultiBinding
                                    Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                    ConverterParameter="100"
                                    FallbackValue="Visibility.Collapsed">
                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}" />
                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}" />
                                </MultiBinding>
                            </RepeatButton.Visibility>
                            <Path
                                x:Name="DownArrow"
                                Data="{StaticResource MenuScrollDownArrowGeometry}"
                                Fill="{StaticResource ForegroundBrush}" />
                        </RepeatButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="true">
            <Rectangle
                x:Name="Bg"
                Margin="1"
                Fill="{TemplateBinding Background}" />
            <DockPanel>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="4,0,6,0"
                    VerticalAlignment="Center"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <Path
                    x:Name="GlyphPanel"
                    Width="7.5"
                    Height="7.5"
                    Margin="5,0,0,0"
                    VerticalAlignment="Center"
                    Data="{StaticResource Checkmark}"
                    Fill="{TemplateBinding Foreground}"
                    FlowDirection="LeftToRight"
                    Stretch="Fill"
                    Visibility="Collapsed" />
                <ContentPresenter
                    x:Name="Content"
                    Margin="{TemplateBinding Padding}"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </DockPanel>
            <Popup
                x:Name="PART_Popup"
                AllowsTransparency="true"
                Focusable="false"
                HorizontalOffset="1"
                IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                Placement="Bottom"
                PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                VerticalOffset="-1">
                <Border x:Name="Shdw" Background="Transparent">
                    <Border
                        x:Name="SubMenuBorder"
                        Background="{StaticResource SubMenuBackgroundBrush}"
                        BorderBrush="{StaticResource SubMenuBorderBrush}"
                        BorderThickness="1">
                        <ScrollViewer
                            x:Name="SubMenuScrollViewer"
                            Margin="1,0"
                            Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
                                                                          TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas
                                    Width="0"
                                    Height="0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top">
                                    <Rectangle
                                        x:Name="OpaqueRect"
                                        Width="{Binding ActualWidth, ElementName=SubMenuBorder}"
                                        Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
                                        Fill="{StaticResource SubMenuBackgroundBrush}" />
                                </Canvas>
                                <ItemsPresenter
                                    x:Name="ItemsPresenter"
                                    Margin="2"
                                    Grid.IsSharedSizeScope="true"
                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                    KeyboardNavigation.TabNavigation="Cycle"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Border>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
                <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
                <Setter TargetName="Shdw" Property="Background" Value="#71000000" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemPressedFill}" />
                <Setter TargetName="Content" Property="TextBlock.Foreground" Value="{StaticResource MouseOverForegroundBrush}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MouseOverForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemPressedFill}" />
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemPressedFill}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource DisabledMenuForeground}" />
            </Trigger>
            <Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
                <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
                <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="true">
            <Rectangle
                x:Name="Bg"
                Margin="1"
                Fill="{TemplateBinding Background}" />
            <DockPanel>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="4,0,6,0"
                    VerticalAlignment="Center"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <Path
                    x:Name="GlyphPanel"
                    Width="7.5"
                    Height="7.5"
                    Margin="5,0,0,0"
                    VerticalAlignment="Center"
                    Data="{StaticResource Checkmark}"
                    Fill="{TemplateBinding Foreground}"
                    FlowDirection="LeftToRight"
                    Stretch="Fill"
                    Visibility="Collapsed" />
                <ContentPresenter
                    Margin="{TemplateBinding Padding}"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </DockPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemSelectionFill}" />
                <Setter Property="TextBlock.Foreground" Value="{StaticResource MouseOverForegroundBrush}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MouseOverForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemPressedFill}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource DisabledMenuForeground}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="true">
            <Rectangle
                x:Name="Bg"
                Fill="{TemplateBinding Background}"
                Stroke="{TemplateBinding BorderBrush}"
                StrokeThickness="1" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="Auto"
                        MinWidth="14"
                        SharedSizeGroup="MenuItemIconColumnGroup" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition MinWidth="37" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
                    <ColumnDefinition Width="17" />
                </Grid.ColumnDefinitions>
                <ContentPresenter
                    x:Name="Icon"
                    Margin="1"
                    VerticalAlignment="Center"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <Border
                    x:Name="GlyphPanel"
                    Margin="1"
                    Background="Transparent"
                    Visibility="Hidden">
                    <Path
                        x:Name="Glyph"
                        Width="7.5"
                        Height="7.5"
                        Margin="5,0,0,0"
                        VerticalAlignment="Center"
                        Data="{StaticResource Checkmark}"
                        Fill="{StaticResource ForegroundBrush}"
                        FlowDirection="LeftToRight"
                        Stretch="Fill" />
                </Border>
                <ContentPresenter
                    x:Name="Content"
                    Grid.Column="2"
                    Margin="{TemplateBinding Padding}"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <TextBlock
                    Grid.Column="4"
                    Margin="{TemplateBinding Padding}"
                    Text="{TemplateBinding InputGestureText}"
                    Visibility="Collapsed" />
                <Path
                    x:Name="RightArrowPath"
                    Grid.Column="5"
                    Margin="4,0,0,0"
                    VerticalAlignment="Center"
                    Data="{StaticResource RightArrow}"
                    Fill="{TemplateBinding Foreground}" />
            </Grid>
            <Popup
                x:Name="PART_Popup"
                AllowsTransparency="true"
                Focusable="false"
                HorizontalOffset="-2"
                IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                Placement="Right"
                PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                VerticalOffset="-3">
                <Border x:Name="Shdw" Background="Transparent">
                    <Border
                        x:Name="SubMenuBorder"
                        Background="{StaticResource SubMenuBackgroundBrush}"
                        BorderBrush="{StaticResource SubMenuBorderBrush}"
                        BorderThickness="1">
                        <ScrollViewer
                            x:Name="SubMenuScrollViewer"
                            Margin="1,0"
                            Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
                                                                          TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas
                                    Width="0"
                                    Height="0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top">
                                    <Rectangle
                                        x:Name="OpaqueRect"
                                        Width="{Binding ActualWidth, ElementName=SubMenuBorder}"
                                        Height="{Binding ActualHeight, ElementName=SubMenuBorder}"
                                        Fill="{StaticResource SubMenuBackgroundBrush}" />
                                </Canvas>
                                <ItemsPresenter
                                    x:Name="ItemsPresenter"
                                    Margin="2"
                                    Grid.IsSharedSizeScope="true"
                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                    KeyboardNavigation.TabNavigation="Cycle"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Border>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
                <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
                <Setter TargetName="Shdw" Property="Background" Value="#71000000" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Bg" Property="Fill" Value="{StaticResource MenuItemSelectionFill}" />
                <Setter TargetName="Content" Property="TextBlock.Foreground" Value="{StaticResource MouseOverForegroundBrush}" />
                <Setter TargetName="RightArrowPath" Property="Fill" Value="{StaticResource MouseOverForegroundBrush}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource MouseOverForegroundBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource DisabledMenuForeground}" />
            </Trigger>
            <Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
                <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}" />
                <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style TargetType="{x:Type MenuItem}">
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="MinHeight" Value="21" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}" />
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Height" Value="25" />
                <Setter Property="Padding" Value="7,6,8,3" />
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}" />
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Height" Value="25" />
                <Setter Property="Padding" Value="7,6,8,3" />
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Height" Value="21" />
                <Setter Property="Padding" Value="2,4,2,2" />
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Height" Value="21" />
                <Setter Property="Padding" Value="2,4,2,2" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--  Separator  -->
    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Grid
                        Margin="3,2,3,2"
                        SnapsToDevicePixels="true"
                        UseLayoutRounding="False">
                        <Rectangle Height="1" Fill="{StaticResource MenuSeparatorBrush}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  ListBox  -->

    <Style TargetType="{x:Type ListBox}">
        <Setter Property="Background" Value="{StaticResource ListBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border
                        x:Name="Bd"
                        Padding="1"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsGrouping" Value="true" />
                                <!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
                            </MultiTrigger.Conditions>
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding" Value="2,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border
                        x:Name="Bd"
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true">
                        <ContentPresenter
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource SelectedListItem}" />
                            <Setter Property="Foreground" Value="{StaticResource SelectedListItemForeground}" />
                        </Trigger>
                        <!--<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="Selector.IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
							</MultiTrigger>-->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsSelected" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource MouseOverListItem}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledMenuForeground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  GroupBox  -->
    <BorderGapMaskConverter x:Key="BorderGapMaskConverter" />
    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="6" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="6" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="6" />
                        </Grid.RowDefinitions>
                        <Border
                            Grid.Row="1"
                            Grid.RowSpan="3"
                            Grid.Column="0"
                            Grid.ColumnSpan="4"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="3">
                            <!--<Border Grid.ColumnSpan="4"
									CornerRadius="3"
									Grid.Row="1"
									Grid.RowSpan="3">-->
                            <Border.OpacityMask>
                                <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
                                    <Binding ElementName="Header" Path="ActualWidth" />
                                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
                                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
                                </MultiBinding>
                            </Border.OpacityMask>
                            <Border
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3">
                                <!--<Border BorderBrush="White"
											BorderThickness="{TemplateBinding BorderThickness}"
											CornerRadius="4"/>-->
                            </Border>
                        </Border>
                        <Border
                            x:Name="Header"
                            Grid.Row="0"
                            Grid.RowSpan="2"
                            Grid.Column="1"
                            Padding="3,1,3,0">
                            <ContentPresenter
                                ContentSource="Header"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                        <ContentPresenter
                            Grid.Row="2"
                            Grid.Column="1"
                            Grid.ColumnSpan="2"
                            Margin="{TemplateBinding Padding}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataGrid styles  -->

    <!--  DataGridSelectAllButtonStyle  -->
    <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle
                            x:Name="Border"
                            Fill="{StaticResource DataGridHeaderBackgroundBrush}"
                            SnapsToDevicePixels="True" />
                        <Polygon
                            x:Name="Arrow"
                            Margin="8,8,3,3"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Bottom"
                            Fill="Black"
                            Opacity="0.15"
                            Points="0,10 10,10 10,0"
                            Stretch="Uniform" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="Stroke" Value="{StaticResource DataGridHeaderMouseOverBrush}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="Fill" Value="{StaticResource DataGridHeaderMouseOverBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Arrow" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataGrid  -->
    <Style TargetType="{x:Type DataGrid}">
        <Setter Property="RowHeight" Value="22" />
        <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource GridLinesBrush}" />
        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource GridLinesBrush}" />
        <Setter Property="Background" Value="{DynamicResource DataGridBackgroundBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource DataGridHeaderBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGrid}">
                    <Border
                        Padding="{TemplateBinding Padding}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Button
                                            Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                            Command="{x:Static DataGrid.SelectAllCommand}"
                                            Focusable="false"
                                            Style="{DynamicResource {ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle,
                                                                                          TypeInTargetAssembly={x:Type DataGrid}}}"
                                            Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                        <DataGridColumnHeadersPresenter
                                            x:Name="PART_ColumnHeadersPresenter"
                                            Grid.Column="1"
                                            Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                        <ScrollContentPresenter
                                            x:Name="PART_ScrollContentPresenter"
                                            Grid.Row="1"
                                            Grid.ColumnSpan="2"
                                            CanContentScroll="{TemplateBinding CanContentScroll}" />
                                        <ScrollBar
                                            x:Name="PART_VerticalScrollBar"
                                            Grid.Row="1"
                                            Grid.Column="2"
                                            Maximum="{TemplateBinding ScrollableHeight}"
                                            Orientation="Vertical"
                                            Style="{StaticResource VerticalScrollBarStyle}"
                                            ViewportSize="{TemplateBinding ViewportHeight}"
                                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                            Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                                        <Grid Grid.Row="2" Grid.Column="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar
                                                x:Name="PART_HorizontalScrollBar"
                                                Grid.Column="1"
                                                Maximum="{TemplateBinding ScrollableWidth}"
                                                Orientation="Horizontal"
                                                Style="{StaticResource HorisontalScrollBarStyle}"
                                                ViewportSize="{TemplateBinding ViewportWidth}"
                                                Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                                Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsGrouping" Value="true" />
                    <!--<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>-->
                </MultiTrigger.Conditions>
                <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <!--  ColumnHeaderGripperStyle  -->
    <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="SizeWE" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataGridColumnHeader  -->
    <Style TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="BorderThickness" Value="1,1,0,1" />
        <Setter Property="BorderBrush" Value="{DynamicResource DataGridHeaderBorderBrush}" />
        <Setter Property="Background" Value="{DynamicResource DataGridHeaderBackgroundBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="Padding" Value="3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Border
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                            <ContentPresenter
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </Border>
                        <Thumb
                            x:Name="PART_LeftHeaderGripper"
                            HorizontalAlignment="Left"
                            Style="{StaticResource ColumnHeaderGripperStyle}" />
                        <Thumb
                            x:Name="PART_RightHeaderGripper"
                            HorizontalAlignment="Right"
                            Style="{StaticResource ColumnHeaderGripperStyle}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource DataGridHeaderMouseOverBrush}" />
                            <Setter Property="Foreground" Value="Black" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataGridRow  -->
    <Style TargetType="{x:Type DataGridRow}">
        <Setter Property="Background" Value="{DynamicResource DataGridRowBackgroundBrush}" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Border.CornerRadius" Value="3" />
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
        <Setter Property="ValidationErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <TextBlock
                        Margin="2,0,0,0"
                        VerticalAlignment="Center"
                        Foreground="Red"
                        Text="!" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRow}">
                    <Border
                        x:Name="DGR_Border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="0"
                        CornerRadius="{TemplateBinding Border.CornerRadius}"
                        SnapsToDevicePixels="True">
                        <SelectiveScrollingGrid>
                            <SelectiveScrollingGrid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </SelectiveScrollingGrid.ColumnDefinitions>
                            <SelectiveScrollingGrid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </SelectiveScrollingGrid.RowDefinitions>
                            <DataGridCellsPresenter
                                Grid.Column="1"
                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <DataGridDetailsPresenter
                                Grid.Row="1"
                                Grid.Column="1"
                                SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                Visibility="{TemplateBinding DetailsVisibility}" />
                            <DataGridRowHeader
                                Grid.RowSpan="2"
                                SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
                                Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                        </SelectiveScrollingGrid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="true" />
                                <Condition Property="IsSelected" Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="DGR_Border" Property="Background" Value="{StaticResource MouseOverListItem}" />
                        </MultiTrigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="DGR_Border" Property="Background" Value="{StaticResource DataGridRowSelectedBrush}" />
                            <Setter TargetName="DGR_Border" Property="CornerRadius" Value="3" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsNewItem" Value="True">
                <Setter Property="Margin" Value="{Binding NewItemMargin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{DynamicResource DataGridRowSelectedBrush}" />
                <Setter Property="Foreground" Value="Black" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--  DataGridCell  -->
    <Style TargetType="{x:Type DataGridCell}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Padding" Value="5,0,5,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border
                        x:Name="Border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="True">
                        <ContentPresenter
                            Margin="{TemplateBinding Padding}"
                            VerticalAlignment="Center"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="BorderBrush" Value="Transparent" />
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource {x:Static DataGrid.FocusBorderBrushKey}}" />
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="true" />
                    <Condition Property="Selector.IsSelectionActive" Value="false" />
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="{StaticResource DataGridRowSelectedBrush}" />
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--  RowHeaderGripperStyle  -->
    <Style x:Key="RowHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Height" Value="8" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="SizeNS" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  DataGridRowHeader  -->
    <Style TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Background" Value="{DynamicResource DataGridBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource DataGridBackgroundBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                    <Grid>
                        <Border
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                            <StackPanel Orientation="Horizontal">
                                <ContentPresenter
                                    VerticalAlignment="Center"
                                    RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                <Control
                                    SnapsToDevicePixels="false"
                                    Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"
                                    Visibility="{Binding (Validation.HasError), Converter={StaticResource bool2VisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" />
                            </StackPanel>
                        </Border>
                        <Thumb
                            x:Name="PART_TopHeaderGripper"
                            VerticalAlignment="Top"
                            Style="{StaticResource RowHeaderGripperStyle}" />
                        <Thumb
                            x:Name="PART_BottomHeaderGripper"
                            VerticalAlignment="Bottom"
                            Style="{StaticResource RowHeaderGripperStyle}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  FilePicker  -->
    <Style x:Key="MainFilePickerStyle" TargetType="{x:Type local:FilePicker}">
        <Setter Property="FontSize" Value="14" />
    </Style>
    <Style BasedOn="{StaticResource MainFilePickerStyle}" TargetType="{x:Type local:FilePicker}" />

</ResourceDictionary>
