<Application x:Class="Translator.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="TranslatorWindow.xaml" Startup="App_Startup"
             DispatcherUnhandledException="App_OnDispatcherUnhandledException">
    <Application.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Themes/IconSet.xaml"/>
                <ResourceDictionary Source="/Themes/Colors.xaml"/>
                <ResourceDictionary Source="/Themes/Buttons.xaml"/>
                <ResourceDictionary Source="/Themes/DataGridStyle.xaml"/>
                <ResourceDictionary Source="/Themes/ComboBox.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <!--Converter-->
            <BooleanToVisibilityConverter x:Key="Bool2VisibilityConverter" />

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

            <Style TargetType="{x:Type TextBox}">
                <Setter Property="Background" Value="White"/>
                <Setter Property="BorderBrush" Value="#FFABAdB3"/>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="Padding" Value="1"/>
                <Setter Property="MinHeight" Value="23"/>
                <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="AllowDrop" Value="true"/>
                <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="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Padding="{TemplateBinding Padding}">
                                <ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Opacity" TargetName="border" Value="0.56"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
                                </Trigger>
                                <Trigger Property="IsKeyboardFocused" Value="true">
                                    <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/>
                            <Condition Property="IsSelectionActive" Value="false"/>
                        </MultiTrigger.Conditions>
                        <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
                    </MultiTrigger>
                </Style.Triggers>
            </Style>

            <!--TextBox for DataGridCells Style-->
            <Style TargetType="{x:Type TextBox}" x:Key="TextBoxCell">
                <Setter Property="VerticalContentAlignment" Value="Stretch" />
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="HorizontalAlignment" Value="Stretch" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="BorderBrush" Value="#606060" />
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor,
                                                             AncestorType={x:Type Control}, AncestorLevel=2}}" />
                <Setter Property="MinWidth" Value="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor,
                                                            AncestorType={x:Type Border}, AncestorLevel=1}}" />

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TextBox}">
                            <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                                    SnapsToDevicePixels="True">
                                <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden"
                                              VerticalScrollBarVisibility="Hidden" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,
                                                             AncestorType={x:Type DataGridCell}, AncestorLevel=1}}" Value="True" />
                                        <Condition Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Mode=FindAncestor,
                                                             AncestorType={x:Type DataGridCell}, AncestorLevel=1}}" Value="False" />
                                        <Condition Binding="{Binding IsKeyboardFocused, RelativeSource={RelativeSource Mode=Self}}" Value="True" />
                                    </MultiDataTrigger.Conditions>

                                    <Setter Property="Foreground" Value="Black" />
                                    <Setter Property="Background" Value="White" />
                                </MultiDataTrigger>

                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,
                                                             AncestorType={x:Type DataGridCell}, AncestorLevel=1}}" Value="True" />
                                        <Condition Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Mode=FindAncestor,
                                                             AncestorType={x:Type DataGridCell}, AncestorLevel=1}}" Value="False" />
                                        <Condition Binding="{Binding IsKeyboardFocused, RelativeSource={RelativeSource Mode=Self}}" Value="False" />
                                    </MultiDataTrigger.Conditions>

                                    <Setter Property="Foreground" Value="White" />
                                </MultiDataTrigger>

                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="Selector.IsSelected" Value="True" />
                                        <Condition Property="IsReadOnly" Value="True" />
                                    </MultiTrigger.Conditions>

                                    <Setter Property="Foreground" Value="#E0E0E0" />
                                </MultiTrigger>

                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Opacity" TargetName="border" Value="0.7" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--CheckBox Style-->
            <Style TargetType="{x:Type CheckBox}">
                <Setter Property="Background" Value="White"/>
                <Setter Property="BorderBrush" Value="#FFABABAB"/>
                <Setter Property="Foreground" Value="#FF444444"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <!--Default Values-->
                <Setter Property="FocusVisualStyle">
                    <Setter.Value>
                        <Style>
                            <Setter Property="Control.Template">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type CheckBox}">
                            <Grid x:Name="templateRoot" Background="Transparent">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Border x:Name="checkBoxBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                        Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        Margin="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Grid x:Name="markGrid">
                                        <!--<Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="#FF858585" Margin="1" Opacity="0" Stretch="None"/>-->
                                        <!--<Path x:Name="optionMark" Data="F1 M 0,58            L 2,56           L 6,60            L 13,51     L 15,53           L 6,64          Z" Fill="#FF858585" Margin="1" Opacity="0" Stretch="None"/>-->
                                        <Path x:Name="optionMark"     Data="F1 M 9.97498,.8 L 4.6983,9.09834  L 1,5.19331 L 1.27664,3.52165 L 4.255,6.08833 L 9.33331,1.288e-005 Z" Fill="#FF858585" Margin="1" Opacity="0" Stretch="None"/>
                                        <Rectangle x:Name="indeterminateMark" Fill="#FF858585" Margin="2" Opacity="0"/>
                                    </Grid>
                                </Border>

                                <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="HasContent" Value="true">
                                    <Setter Property="FocusVisualStyle">
                                        <Setter.Value>
                                            <Style>
                                                <Setter Property="Control.Template">
                                                    <Setter.Value>
                                                        <ControlTemplate>
                                                            <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Padding" Value="4,-1,0,0"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFD5E1F2"/>
                                    <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FFA3BDE3"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF212121"/>
                                    <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF212121"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFE6E6E6"/>
                                    <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FFBCBCBC"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF707070"/>
                                    <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF707070"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFA3BDE3"/>
                                    <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FFA3BDE3"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF212121"/>
                                    <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF212121"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="true">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                                    <Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="{x:Null}">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="0"/>
                                    <Setter Property="Opacity" TargetName="indeterminateMark" Value="1"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--RadioButton Style-->
            <Style TargetType="{x:Type RadioButton}">
                <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}"/>
                <Setter Property="Background" Value="White"/>
                <Setter Property="BorderBrush" Value="#FFACACAC"/>
                <Setter Property="Foreground" Value="#FF444444"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="2,0,0,0"/>
                <Setter Property="BorderThickness" Value="1"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type RadioButton}">
                            <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Border x:Name="radioButtonBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                        Background="{TemplateBinding Background}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                        Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <Grid x:Name="markGrid" Margin="2">
                                        <Ellipse x:Name="optionMark" Fill="#FF777777" MinWidth="6" MinHeight="6" Opacity="0"/>
                                    </Grid>
                                </Border>

                                <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" 
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                                  RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter Property="Background" TargetName="radioButtonBorder" Value="#FFD5E1F2"/>
                                    <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FFA7C0E4"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF444444"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter Property="Background" TargetName="radioButtonBorder" Value="#FFA7C0E4"/>
                                    <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FFA7C0E4"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF444444"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="true">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="{x:Null}">
                                    <Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" TargetName="radioButtonBorder" Value="#FFE6E6E6"/>
                                    <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="#FFBCBCBC"/>
                                    <Setter Property="Fill" TargetName="optionMark" Value="#FF707070"/>
                                    <Setter Property="Foreground" Value="#FFB1B1B1"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Tooltip Style-->
            <Style TargetType="{x:Type ToolTip}">
                <Setter Property="Foreground" Value="#FF5D5D5D"/>
                <Setter Property="MinWidth" Value="20"/>
                <Setter Property="SnapsToDevicePixels" Value="True"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToolTip}">
                            <Grid>
                                <Rectangle StrokeThickness="2" Margin="15,0,0,0" HorizontalAlignment="Left">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#00BEBEBE" Offset="0"/>
                                            <GradientStop Color="#00BEBEBE" Offset="1"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.2"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.8"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>

                                <Rectangle StrokeThickness="2" Margin="0,0,15,0" HorizontalAlignment="Right" >
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#00BEBEBE" Offset="0"/>
                                            <GradientStop Color="#00BEBEBE" Offset="1"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.2"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.8"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>

                                <Border BorderBrush="#FFBEBEBE" BorderThickness="1" Effect="{DynamicResource Shadow.Border.Large}" Margin="5" Background="White" Padding="5">
                                    <!--<TextBlock Text="{TemplateBinding Content}" Foreground="#FF5D5D5D" Padding="5" TextWrapping="WrapWithOverflow" 
                                                   Width="Auto" HorizontalAlignment="Center" MinWidth="40" TextAlignment="Center" />-->
                                    <ContentPresenter Content="{TemplateBinding Content}" Width="Auto" HorizontalAlignment="Center"/>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Context Menu-->
            <Style TargetType="{x:Type ContextMenu}">
                <Setter Property="SnapsToDevicePixels" Value="True" />
                <Setter Property="OverridesDefaultStyle" Value="True" />
                <Setter Property="Grid.IsSharedSizeScope" Value="true" />
                <Setter Property="Placement" Value="Bottom"/>
                <Setter Property="HorizontalOffset" Value="-5"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ContextMenu}">
                            <Grid>
                                <Rectangle StrokeThickness="2" Margin="15,0,0,0" HorizontalAlignment="Left">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#00BEBEBE" Offset="0"/>
                                            <GradientStop Color="#00BEBEBE" Offset="1"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.2"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.8"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>

                                <Rectangle StrokeThickness="2" Margin="0,0,15,0" HorizontalAlignment="Right" >
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#00BEBEBE" Offset="0"/>
                                            <GradientStop Color="#00BEBEBE" Offset="1"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.2"/>
                                            <GradientStop Color="#FFB1B1B1" Offset="0.8"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>

                                <Border x:Name="Border" BorderBrush="#FFBEBEBE" BorderThickness="1" Effect="{DynamicResource Shadow.Border.Large}" Margin="5,5,5,5" Background="White">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Separator-->
            <Style TargetType="{x:Type Separator}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Separator}">
                            <Rectangle Height="{TemplateBinding Height}" Fill="#FFE0E3E6"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--Label Separator-->
            <Style x:Key="LabelSeparator" TargetType="{x:Type Label}">
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Padding" Value="3,1"/>
                <Setter Property="Background" Value="#FFE0E3E6"/>
                <Setter Property="Foreground" Value="#FF000000"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Label}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Label Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" 
                                       ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"
                                       ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Content="{TemplateBinding Content}"/>

                                <Rectangle Grid.Column="1" Height="1" Fill="{TemplateBinding Background}" VerticalAlignment="Center" Margin="5,0,0,0"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!--TabItem Style-->
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid Name="Panel" Background="Transparent">
                                <Border Name="ContentBorder" BorderBrush="#FFD4D4D4" BorderThickness="0">
                                    <ContentPresenter x:Name="ContentSite" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                      ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Content="{TemplateBinding Content}"
                                                      VerticalAlignment="Center" Effect="{x:Null}" HorizontalAlignment="Center" ContentSource="Header" Margin="10,2"/>
                                </Border>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter TargetName="Panel" Property="Background" Value="#FFFAFAFA" />
                                    <Setter Property="Foreground" Value="#FF2B579A" />
                                    <Setter TargetName="ContentBorder" Property="BorderThickness" Value="1,1,1,0" />
                                </Trigger>

                                <Trigger Property="IsMouseOver" Value="True" SourceName="Panel">
                                    <Setter Property="Foreground" Value="#FF2B579A" />
                                    <Setter Property="Background" Value="#FFFAFAFA" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>

                <!--Default Values-->
                <Setter Property="FontFamily" Value="Segoe UI Semilight"/>
                <!--<Setter Property="Background" Value="#7FFFFFFF"/>-->
            </Style>

            <!--ScrollBar Styles-->
            <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
                <Setter Property="OverridesDefaultStyle" Value="true"/>
                <Setter Property="Focusable" Value="false"/>
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="FocusVisualStyle">
                    <Setter.Value>
                        <Style>
                            <Setter Property="Control.Template">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                            <Grid x:Name="Root" Margin="0">
                                <Border x:Name="BackgroundBorder" Background="White" BorderBrush="#FFAAAAAA" BorderThickness="1"/>
                                <Path x:Name="Arrow" Stretch="None" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Fill="#FF777777" HorizontalAlignment="Center"  VerticalAlignment="Center" SnapsToDevicePixels="True"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="White"/>
                                    <Setter TargetName="BackgroundBorder" Property="BorderBrush" Value="#FF777777"/>
                                    <Setter TargetName="Arrow" Property="Fill" Value="#FF777777"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter TargetName="BackgroundBorder" Property="Background" Value="#FFF2F2F2"/>
                                    <Setter TargetName="BackgroundBorder" Property="BorderBrush" Value="#FF777777"/>
                                    <Setter TargetName="Arrow" Property="Fill" Value="#FF777777"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type Thumb}">
                <Setter Property="SnapsToDevicePixels" Value="True"/>
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="Focusable" Value="false"/>
                <Setter Property="Background" Value="White"/>
                <Setter Property="BorderBrush" Value="#FFAAAAAA"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Grid Background="Transparent">
                                <Border Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#FFF2F2F2"/>
                                    <Setter Property="BorderBrush" Value="#FFAAAAAA"/>
                                </Trigger>
                                <Trigger Property="IsDragging" Value="True">
                                    <Setter Property="Background" Value="#FFF2F2F2"/>
                                    <Setter Property="BorderBrush" Value="#FF777777"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="RepeatButtonTransparent" 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 Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type ScrollBar}">
                <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
                <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
                <Setter Property="Background" Value="#FFEFEFEF"/>
                <Setter Property="BorderBrush" Value="#F0F0F0"/>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                <Setter Property="BorderThickness" Value="1,0"/>
                <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" SnapsToDevicePixels="true">
                                <Grid.RowDefinitions>
                                    <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                    <RowDefinition Height="0.00001*"/>
                                    <RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
                                </Grid.RowDefinitions>
                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Row="1"/>
                                <RepeatButton Grid.Row="0" x:Name="PART_LineUpButton" Command="{x:Static ScrollBar.LineUpCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Content="M 0,4 C0,4 0,6 0,6 0,6 3.5,2.5 3.5,2.5 3.5,2.5 7,6 7,6 7,6 7,4 7,4 7,4 3.5,0.5 3.5,0.5 3.5,0.5 0,4 0,4 z" />
                                <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb Style="{StaticResource ScrollBarThumbVertical}"/>
                                    </Track.Thumb>
                                </Track>
                                <RepeatButton x:Name="PART_LineDownButton" Command="{x:Static ScrollBar.LineDownCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="2" Style="{StaticResource ScrollBarButton}" Content="M 0,2.5 C0,2.5 0,0.5 0,0.5 0,0.5 3.5,4 3.5,4 3.5,4 7,0.5 7,0.5 7,0.5 7,2.5 7,2.5 7,2.5 3.5,6 3.5,6 3.5,6 0,2.5 0,2.5 z" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" TargetName="Bg" Value="#FFF2F2F2"/>
                                </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="BorderThickness" Value="0,1"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ScrollBar}">
                                    <Grid x:Name="Bg" SnapsToDevicePixels="true">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                            <ColumnDefinition Width="0.00001*"/>
                                            <ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
                                        </Grid.ColumnDefinitions>
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1"/>
                                        <RepeatButton Grid.Column="0" x:Name="PART_LineLeftButton" Command="{x:Static ScrollBar.LineLeftCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Content="M 3.18,7 C3.18,7 5,7 5,7 5,7 1.81,3.5 1.81,3.5 1.81,3.5 5,0 5,0 5,0 3.18,0 3.18,0 3.18,0 0,3.5 0,3.5 0,3.5 3.18,7 3.18,7 z" />
                                        <Track x:Name="PART_Track" Grid.Column="1" IsEnabled="{TemplateBinding IsMouseOver}">
                                            <Track.DecreaseRepeatButton>
                                                <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
                                            </Track.DecreaseRepeatButton>
                                            <Track.IncreaseRepeatButton>
                                                <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource RepeatButtonTransparent}"/>
                                            </Track.IncreaseRepeatButton>
                                            <Track.Thumb>
                                                <Thumb Style="{StaticResource ScrollBarThumbVertical}"/>
                                            </Track.Thumb>
                                        </Track>
                                        <RepeatButton x:Name="PART_LineRightButton" Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Content="M 1.81,7 C1.81,7 0,7 0,7 0,7 3.18,3.5 3.18,3.5 3.18,3.5 0,0 0,0 0,0 1.81,0 1.81,0 1.81,0 5,3.5 5,3.5 5,3.5 1.81,7 1.81,7 z" />
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsEnabled" Value="false">
                                            <Setter Property="Background" TargetName="Bg" Value="#FFF2F2F2"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <!--Scroll Viewer Style-->
            <Style TargetType="{x:Type ScrollViewer}">
                <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.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
                                <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
                                <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
                                <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Foreground" Value="White"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="ViewBoxStyle" TargetType="{x:Type Viewbox}">
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value=".6"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <!--Expander Style-->
            <SolidColorBrush x:Key="Expander.MouseOver.Circle.Fill" Color="#FFF3F9FF"/>
            <SolidColorBrush x:Key="Expander.Pressed.Circle.Fill" Color="#FFD9ECFF"/>
            <SolidColorBrush x:Key="Expander.Disabled.Arrow.Stroke" Color="#FF707070"/>
            <SolidColorBrush x:Key="Expander.Static.Arrow.Stroke" Color="#FF333333"/>

            <Style x:Key="ExpanderHeaderFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Border>
                                <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="19"/>
                                    </Grid.RowDefinitions>

                                    <Label Grid.Row="0" Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}"
                                       HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                                    <Rectangle Grid.Row="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="#FFE0E3E6" 
                                           Height="Auto" HorizontalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Row="2" x:Name="ArrowPath" Data="M 1,1  L 4.5,4.5  L 1,8" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                      Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 4.5,1  L 1,4.5  L 4.5,8"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.MouseOver.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.Pressed.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{StaticResource Expander.Disabled.Arrow.Stroke}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="19"/>
                                    </Grid.RowDefinitions>

                                    <Label Grid.Row="0" Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}"
                                       HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>

                                    <Rectangle Grid.Row="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="#FFE0E3E6" 
                                           Height="Auto" HorizontalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Row="2" x:Name="ArrowPath" Data="M 4.5,1  L 1,4.5  L 4.5,8" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                      Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,1  L 4.5,4.5  L 1,8"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.MouseOver.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.Pressed.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{StaticResource Expander.Disabled.Arrow.Stroke}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Height" Value="27"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="19"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Column="0" Content="{TemplateBinding Content}" Padding="3" Foreground="{TemplateBinding Foreground}"
                                           VerticalContentAlignment="Center"/>

                                    <Rectangle Grid.Column="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="#FFE0E3E6" 
                                               Height="Auto" VerticalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Column="2" x:Name="ArrowPath" Data="M 1,4.5 L 4.5,1 L 8,4.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                          Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.MouseOver.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.Pressed.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{StaticResource Expander.Disabled.Arrow.Stroke}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
                <Setter Property="Height" Value="27"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" >
                                <Grid SnapsToDevicePixels="False">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="19"/>
                                    </Grid.ColumnDefinitions>

                                    <Label Grid.Column="0" Content="{TemplateBinding Content}" Padding="3" Foreground="{TemplateBinding Foreground}"
                                           VerticalContentAlignment="Center"/>

                                    <Rectangle Grid.Column="1" x:Name="HorizontalRectangle" MinHeight="1" Fill="#FFE0E3E6" 
                                               Height="Auto" VerticalAlignment="Center" Margin="3,0,3,0"/>

                                    <Path Grid.Column="2" x:Name="ArrowPath" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="False" 
                                          Stroke="{StaticResource Expander.Static.Arrow.Stroke}" StrokeThickness="2" VerticalAlignment="Center"/>
                                </Grid>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Data" TargetName="ArrowPath" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Cursor" Value="Hand"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.MouseOver.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="Stroke" TargetName="HorizontalRectangle" Value="#FFB3B5B8"/>
                                    <Setter Property="Background" Value="{StaticResource Expander.Pressed.Circle.Fill}"/>
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="Black"/>
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Stroke" TargetName="ArrowPath" Value="{StaticResource Expander.Disabled.Arrow.Stroke}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type Expander}">
                <Setter Property="Foreground" Value="Black"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Expander}">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                <DockPanel>
                                    <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                                                  Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" 
                                                  FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" 
                                                  FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0"
                                                  Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" 
                                                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>

                                    <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                      Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                </DockPanel>
                            </Border>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsExpanded" Value="True">
                                    <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Right">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                                    <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Up">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                                    <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                                </Trigger>
                                <Trigger Property="ExpandDirection" Value="Left">
                                    <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                                    <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                                    <Setter Property="Style" TargetName="HeaderSite" 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>
        </ResourceDictionary>
    </Application.Resources>
</Application>
