ceKey TypeInTargetAssembly={x:Type Calendar}, ResourceId=CalendarBackgroundBrush}}" />
        <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Calendar">
                    <StackPanel Name="PART_Root" HorizontalAlignment="Center">
                        <CalendarItem 
                            Name="PART_CalendarItem" 
                            Style="{TemplateBinding CalendarItemStyle}"
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"                            
                            />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="CalendarItem">
        <Setter Property="Margin" Value="0,3,0,3" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CalendarItem">
                    <ControlTemplate.Resources>
                        <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
                            <TextBlock
                                FontWeight="Bold" 
                                FontFamily="Verdana" 
                                FontSize="9.5" 
                                Foreground="#FF333333" 
                                HorizontalAlignment="Center"
                                Text="{Binding}"
                                Margin="0,6,0,6"
                                VerticalAlignment="Center"/>
                        </DataTemplate>
                    </ControlTemplate.Resources>
                    <Grid Name="PART_Root" >
                        <Grid.Resources>
                            <SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF" />
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualState Name="Normal" />
                                <VisualState Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PART_DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}">
                            <Border BorderBrush="#FFFFFFFF" BorderThickness="2">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
    
                                    <Grid.Resources>
                                        <ControlTemplate x:Key="PreviousButtonTemplate" TargetType="Button">                                            
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup Name="CommonStates">
                                                        <VisualState Name="Normal" />
                                                        <VisualState Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimation Storyboard.TargetName="path" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" To="#FF73A9D8" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="path" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Opacity)" To=".5" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/>
                                                <Grid>
                                                    <Path x:Name="path" Margin="14,-6,0,0" Height="10" Width="6" VerticalAlignment="Center" HorizontalAlignment="Left" Stretch="Fill" Data="M288.75,232.25 L288.75,240.625 L283,236.625 z">
                                                        <Path.Fill>
                                                            <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}" />
                                                        </Path.Fill>
                                                    </Path>
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
    
    
                                        <ControlTemplate x:Key="NextButtonTemplate" TargetType="Button">
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup Name="CommonStates">
                                                        <VisualState Name="Normal" />
                                                        <VisualState Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimation Storyboard.TargetName="path" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" To="#FF73A9D8" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="path" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Opacity)" To=".5" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Rectangle Fill="#11E5EBF1" Stretch="Fill" Opacity="1"/>
                                                <Grid>
                                                    <Path x:Name="path" Margin="0,-6,14,0" Height="10" Width="6" VerticalAlignment="Center" HorizontalAlignment="Right" Stretch="Fill" Data="M282.875,231.875 L282.875,240.375 L288.625,236 z">
                                                        <Path.Fill>
                                                            <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}" />
                                                        </Path.Fill>
                                                    </Path>
                                                </Grid>
                                            </Grid>
                                        </ControlTemplate>
    
    
                                        <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button">
                                            <Grid Cursor="Hand">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup Name="CommonStates">
                                                        <VisualState Name="Normal" />
                                                        <VisualState Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimation Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" To="#FF73A9D8" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState Name="Disabled">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="buttonContent" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <ContentPresenter
                                                  x:Name="buttonContent"
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Margin="1,4,1,9"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                                     <TextElement.Foreground>
                                                        <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}"/>
                                                    </TextElement.Foreground>
                                                </ContentPresenter>
                                            </Grid>
                                        </ControlTemplate>
    
                                    </Grid.Resources>
    
                                    <Button x:Name="PART_PreviousButton" 
                                            Grid.Row="0" Grid.Column="0"
                                            Template="{StaticResource PreviousButtonTemplate}" 
                                            Height="20" Width="28" 
                                            HorizontalAlignment="Left" 
                                            Focusable="False"
                                            />
    
                                    <Button x:Name="PART_HeaderButton"                                             
                                            Grid.Row="0" Grid.Column="1" 
                                            Template="{StaticResource HeaderButtonTemplate}" 
                                            HorizontalAlignment="Center" VerticalAlignment="Center" 
                                            FontWeight="Bold" FontSize="10.5" 
                                            Focusable="False"
                                            />
    
                                    <Button x:Name="PART_NextButton" 
                                            Grid.Row="0" Grid.Column="2" 
                                            Height="20" Width="28" 
                                            HorizontalAlignment="Right" 
                                            Template="{StaticResource NextButtonTemplate}" 
                                            Focusable="False"
                                            />
    
                                    <Grid x:Name="PART_MonthView" Grid.Row="1" Grid.ColumnSpan="3" Visibility="Visible" Margin="6,-1,6,6" HorizontalAlignment="Center">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                    </Grid>
    
                                    <Grid x:Name="PART_YearView" Grid.Row="1" Grid.ColumnSpan="3" Visibility="Hidden" Margin="6,-3,7,6" HorizontalAlignment="Center">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                    </Grid>
                                </Grid>
                            </Border>
                        </Border>
                        <Rectangle x:Name="PART_DisabledVisual" Opacity="0" Visibility="Collapsed" Stretch="Fill" StrokeThickness="1" Stroke="{StaticResource DisabledColor}" Fill="{StaticResource DisabledColor}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="PART_DisabledVisual" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <DataTrigger Value="Year">
                            <DataTrigger.Binding>
                                <Binding Path="DisplayMode">
                                    <Binding.RelativeSource>
                                        <RelativeSource Mode="FindAncestor" AncestorType="{x:Type Calendar}" />
                                    </Binding.RelativeSource>
                                </Binding>
                            </DataTrigger.Binding>
                            <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                            <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                        </DataTrigger>
                        <DataTrigger Value="Decade">
                            <DataTrigger.Binding>
                                <Binding Path="DisplayMode">
                                    <Binding.RelativeSource>
                                        <RelativeSource Mode="FindAncestor" AncestorType="{x:Type Calendar}" />
                                    </Binding.RelativeSource>
                                </Binding>
                            </DataTrigger.Binding>
                            <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
                            <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>        
    </Style>

    <Style TargetType="CalendarDayButton">
        <Setter Property="MinWidth" Value="5"/>
        <Setter Property="MinHeight" Value="5"/>
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CalendarDayButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground" Storyboard.TargetProperty="Opacity" To="0.5" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightBackground" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="NormalText" Storyboard.TargetProperty="Opacity" To=".35" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unselected" />
                                <VisualState Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectedBackground" Storyboard.TargetProperty="Opacity" To=".75" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DayButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Active" />
                                <VisualState Name="Inactive">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" Storyboard.TargetName="NormalText" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" To="#FF777777"></ColorAnimation>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="DayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="RegularDay" />
                                <VisualState Name="Today">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TodayBackground" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                        <ColorAnimation Duration="0" Storyboard.TargetName="NormalText" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" To="#FFFFFFFF"></ColorAnimation>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="BlackoutDayStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="NormalDay" />
                                <VisualState Name="BlackoutDay">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="Blackout" Storyboard.TargetProperty="Opacity" To=".2"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="TodayBackground" Opacity="0" Fill="#FFAAAAAA"/>
                        <Rectangle x:Name="SelectedBackground" Opacity="0" Fill="#FFBADDE9"/>
                        <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"/>
                        <Rectangle x:Name="HighlightBackground" Opacity="0" Fill="#FFBADDE9"/>
                        <ContentPresenter
                                x:Name="NormalText"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Margin="5,1,5,1">
                            <TextElement.Foreground>
                                <SolidColorBrush Color="#FF333333" />
                            </TextElement.Foreground>
                        </ContentPresenter>
                        <Path x:Name="Blackout" Opacity="0" Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" Fill="#FF000000" Stretch="Fill" Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"/>
                        <Rectangle x:Name="DayButtonFocusVisual" Visibility="Collapsed" IsHitTestVisible="false" Stroke="#FF45D6FA"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="CalendarButton">
        <Setter Property="Background" Value="#FFBADDE9"/>
        <Setter Property="MinWidth" Value="40"/>
        <Setter Property="MinHeight" Value="42"/>
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CalendarButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".5" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="SelectionStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unselected" />
                                <VisualState Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="SelectedBackground" Storyboard.TargetProperty="Opacity" To=".75" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="ActiveStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Active" />
                                <VisualState Name="Inactive">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" Storyboard.TargetName="NormalText" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" To="#FF777777"></ColorAnimation>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="CalendarButtonFocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="CalendarButtonFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CalendarButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState Name="CalendarButtonUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CalendarButtonFocusVisual" Storyboard.TargetProperty="Visibility" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="SelectedBackground" Opacity="0" Fill="{TemplateBinding Background}"/>
                        <Rectangle x:Name="Background" Opacity="0" Fill="{TemplateBinding Background}"/>
                        <ContentPresenter
                                x:Name="NormalText"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Margin="1,0,1,1">
                            <TextElement.Foreground>
                                <SolidColorBrush Color="#FF333333"/>
                            </TextElement.Foreground>
                        </ContentPresenter>
                        <Rectangle x:Name="CalendarButtonFocusVisual" Visibility="Collapsed" IsHitTestVisible="false" Stroke="#FF45D6FA"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="CalendarButtonFocusVisual" Property="Visibility" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <DataTemplate DataType="{x:Type CollectionViewGroup}">
        <ContentPresenter Content="{Binding Path=Name}" ContentStringFormat="{TemplateBinding ContentStringFormat}"/>
    </DataTemplate>

 
    <Style x:Key="{x:Type ContentControl}"
           TargetType="{x:Type ContentControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContentControl}">
                    <ContentPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



 
    <Style x:Key="{x:Type FlowDocument}"
           TargetType="{x:Type FlowDocument}">
        <Setter Property="TextAlignment"
                Value="Justify"/>
        <Setter Property="FontFamily"
                Value="Georgia"/>
        <Setter Property="FontSize"
                Value="16.0"/>
    </Style>
    <Style x:Key="{x:Type TextBlock}"
           TargetType="{x:Type TextBlock}">
        <Setter Property="TextWrapping"
                Value="NoWrap"/>
        <Setter Property="TextTrimming"
                Value="None"/>
    </Style>
    <Style x:Key="{x:Type Bold}"
           TargetType="{x:Type Bold}">
        <Setter Property="FontWeight"
                Value="Bold"/>
    </Style>
    <Style x:Key="{x:Type Italic}"
           TargetType="{x:Type Italic}">
        <Setter Property="FontStyle"
                Value="Italic"/>
    </Style>
    <Style x:Key="{x:Type Underline}"
           TargetType="{x:Type Underline}">
        <Setter Property="TextDecorations"
                Value="Underline"/>
    </Style>
    <Style x:Key="{x:Type Paragraph}"
           TargetType="{x:Type Paragraph}">
        <Setter Property="Margin"
                Value="Auto"/>
    </Style>
    <Style x:Key="{x:Type List}"
           TargetType="{x:Type List}">
        <Setter Property="Margin"
                Value="Auto"/>
        <Setter Property="Padding"
                Value="Auto"/>
    </Style>
    <Style x:Key="{x:Type Floater}"
           TargetType="{x:Type Floater}">
        <Setter Property="HorizontalAlignment"
                Value="Right"/>
    </Style>
    
    <DataTemplate DataType="{x:Type FlowDocument}">
        <FlowDocumentReader Document="{Binding}" />
    </DataTemplate>
    <DataTemplate DataType="{x:Type FixedDocument}">
        <DocumentViewer Document="{Binding}"/>
    </DataTemplate>
    <DataTemplate DataType="{x:Type FixedDocumentSequence}">
        <DocumentViewer Document="{Binding}"/>
    </DataTemplate>
    <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=DocumentViewerToolBarGradient}"
                         StartPoint="0,0"
                         EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="{x:Static SystemColors.InactiveCaptionTextColor}"
                          Offset="0"/>
            <GradientStop Color="{x:Static SystemColors.InactiveCaptionColor}"
                          Offset="1"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="DocumentViewerToolBarDividerGradient"
                         StartPoint="0,0"
                         EndPoint="1,0">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="{x:Static SystemColors.InactiveCaptionTextColor}"
                          Offset="1"/>
            <GradientStop Color="{x:Static SystemColors.InactiveCaptionColor}"
                          Offset="0"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    <Style x:Key="{x:Type DocumentViewer}"
           BasedOn="{x:Null}"
           TargetType="{x:Type DocumentViewer}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}"/>
        <Setter Property="ContextMenu"
                Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type ui:PresentationUIStyleResources}, ResourceId=PUIDocumentViewerContextMenu}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DocumentViewer}">
                  <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Focusable="False">
                    <Grid Background="{TemplateBinding Background}"
                          KeyboardNavigation.TabNavigation="Local">
                      <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                      </Grid.ColumnDefinitions>
                      <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                      </Grid.RowDefinitions>
                      <ContentControl Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type ui:PresentationUIStyleResources},                                 ResourceId=PUIDocumentViewerToolBarStyleKey}}"
                                      Grid.Row="0"
                                      Grid.Column="0"
                                      Focusable="{TemplateBinding Focusable}"
                                      TabIndex="0"/>
                      <ScrollViewer Grid.Row="1"
                                    Grid.Column="0"
                                    CanContentScroll="true"
                                    HorizontalScrollBarVisibility="Auto"
                                    x:Name="PART_ContentHost"
                                    Focusable="{TemplateBinding Focusable}"
                                    IsTabStop="true"
                                    TabIndex="1"/>
                      <DockPanel Grid.Row="1">
                        <FrameworkElement DockPanel.Dock="Right"
                                          Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
                        <Rectangle
                                   Visibility="Visible"
                                   VerticalAlignment="top"
                                   Height="10">
                          <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                              <GradientBrush.GradientStops>
                                <GradientStopCollection>
                                  <GradientStop Color="#66000000"
                                                Offset="0"/>
                                  <GradientStop Color="Transparent"
                                                Offset="1"/>
                                </GradientStopCollection>
                              </GradientBrush.GradientStops>
                            </LinearGradientBrush>
                          </Rectangle.Fill>
                        </Rectangle>
                      </DockPanel>
                      <ContentControl Grid.Row="2"
                                      Grid.Column="0"
                                      TabIndex="2"
                                      Focusable="{TemplateBinding Focusable}"
                                      x:Name="PART_FindToolBarHost"/>
                    </Grid>
                  </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>




    <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter" />

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

    <Style x:Key="{x:Type DataGrid}" TargetType="{x:Type DataGrid}">
        <Setter Property="Background"
                      Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="Foreground"
                      Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderBrush" Value="#FF688CAF" />
        <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 Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}"
                      SnapsToDevicePixels="True"
                      Padding="{TemplateBinding Padding}">
                        <ScrollViewer   Focusable="false"
                                Name="DG_ScrollViewer">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>

                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>

                                        <Button Command="{x:Static DataGrid.SelectAllCommand}"
                                                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=CellsPanelHorizontalOffset}"
                                                Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type DataGrid}, ResourceId=DataGridSelectAllButtonStyle}}"
                                                Focusable="false"
                                                Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.All}}" />
                                        <DataGridColumnHeadersPresenter Grid.Column="1"
                                                           Name="PART_ColumnHeadersPresenter"
                                                           Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Column}}"/>

                                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.Row="1" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" />

                                        <ScrollBar Grid.Row="1" Grid.Column="2" Name="PART_VerticalScrollBar"
                                                 Orientation="Vertical"
                                                 Maximum="{TemplateBinding ScrollableHeight}"
                                                 ViewportSize="{TemplateBinding ViewportHeight}"
                                                 Value="{Binding Path=VerticalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                                 Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>

                                        <Grid Grid.Row="2" Grid.Column="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=NonFrozenColumnsViewportHorizontalOffset}"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar Grid.Column="1"
                                                       Name="PART_HorizontalScrollBar"
                                                       Orientation="Horizontal"
                                                       Maximum="{TemplateBinding ScrollableWidth}"
                                                       ViewportSize="{TemplateBinding ViewportWidth}"
                                                       Value="{Binding Path=HorizontalOffset, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
                                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>

                                        </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>

    <Style x:Key="{x:Type DataGridColumnHeadersPresenter}" TargetType="{x:Type DataGridColumnHeadersPresenter}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">
                    <Grid>
                        <DataGridColumnHeader IsHitTestVisible="False" Name="PART_FillerColumnHeader"/>
                        <ItemsPresenter />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <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>

    <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>

    <Style x:Key="{x:Static DataGridColumnHeader.ColumnFloatingHeaderStyleKey}" TargetType="{x:Type Control}">
        <Setter Property="Opacity" Value="0.6"></Setter>
        <Setter Property="BorderBrush" Value="#FF688CAF"></Setter>
        <Setter Property="BorderThickness" Value="1"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Control}">
                    <Border BorderThickness="{TemplateBinding BorderThickness}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              Padding ="{TemplateBinding Padding}"
                              Background="{TemplateBinding Background}">
                        <Grid>
                            <Canvas Name="PART_VisualBrushCanvas" Margin="{TemplateBinding Margin}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Static DataGridColumnHeader.ColumnHeaderDropSeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Background" Value="#FF000080" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"
                              SnapsToDevicePixels="True">
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type DataGridRow}" TargetType="{x:Type DataGridRow}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <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="{TemplateBinding BorderThickness}"
                      SnapsToDevicePixels="True">
                        <SelectiveScrollingGrid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <DataGridCellsPresenter Grid.Column="1"
                                             ItemsPanel="{TemplateBinding ItemsPanel}"
                                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>

                            <DataGridDetailsPresenter  SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=AreRowDetailsFrozen, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}}"
                                                Grid.Column="1" Grid.Row="1"
                                                Visibility="{TemplateBinding DetailsVisibility}" />

                            <DataGridRowHeader SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"  Grid.RowSpan="2"
                                        Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Row}}"/>
                        </SelectiveScrollingGrid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsNewItem" Value="True">
                <Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, Path=NewItemMargin}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type DataGridCellsPresenter}" TargetType="{x:Type DataGridCellsPresenter}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCellsPresenter}">
                    <ItemsPresenter />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="{x:Static DataGrid.FocusBorderBrushKey}"
                       Color="#FF000000" />

    <Style x:Key="{x:Type DataGridCell}" TargetType="{x:Type DataGridCell}">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}"
                      SnapsToDevicePixels="True">
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
            </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="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/>
                <Setter Property="BorderBrush" 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="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Static DataGridComboBoxColumn.TextBlockComboBoxStyleKey}" TargetType="{x:Type ComboBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <ContentPresenter Margin="1,1,1,1"
                                Content="{TemplateBinding SelectionBoxItem}"
                                ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                IsHitTestVisible="false" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="{x:Type DataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <theme:DataGridHeaderBorder SortDirection="{TemplateBinding SortDirection}"
                                         IsHovered="{TemplateBinding IsMouseOver}"
                                         IsPressed="{TemplateBinding IsPressed}"
                                         IsClickable="{TemplateBinding CanUserSort}"
                                         Background="{TemplateBinding Background}"
                                         BorderBrush="{TemplateBinding BorderBrush}"
                                         BorderThickness="{TemplateBinding BorderThickness}"
                                         Padding ="{TemplateBinding Padding}"
                                         SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
                                         SeparatorBrush="{TemplateBinding SeparatorBrush}">
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      RecognizesAccessKey="True" />
                        </theme:DataGridHeaderBorder>

                        <Thumb x:Name="PART_LeftHeaderGripper"
                               HorizontalAlignment="Left"
                               Style="{StaticResource ColumnHeaderGripperStyle}"/>
                        <Thumb x:Name="PART_RightHeaderGripper"
                               HorizontalAlignment="Right"
                               Style="{StaticResource ColumnHeaderGripperStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type DataGridRowHeader}" TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                    <Grid>
                        <theme:DataGridHeaderBorder IsSelected="{TemplateBinding IsRowSelected}"
                                         IsHovered ="{TemplateBinding IsMouseOver}"
                                         IsPressed="{TemplateBinding IsPressed}"
                                         Background="{TemplateBinding Background}"
                                         BorderBrush="{TemplateBinding BorderBrush}"
                                         BorderThickness="{TemplateBinding BorderThickness}"
                                         Padding ="{TemplateBinding Padding}"
                                         Orientation="Horizontal"
                                         SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
                                         SeparatorBrush="{TemplateBinding SeparatorBrush}">

                            <StackPanel Orientation="Horizontal">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"
                                                  RecognizesAccessKey="True"/>
                                <Control SnapsToDevicePixels="false"
                                         Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=(Validation.HasError), Converter={StaticResource bool2VisibilityConverter}}"
                                         Template="{Binding RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}, Path=ValidationErrorTemplate}" />
                            </StackPanel>
                        </theme:DataGridHeaderBorder>
                        <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>



    <SolidColorBrush x:Key="Expander.Static.Foreground" Color="#FF000000" />
    <SolidColorBrush x:Key="Expander.Static.Glyph" Color="#FF282828" />
    <SolidColorBrush x:Key="Expander.MouseOver.Glyph" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="Expander.Pressed.Glyph" Color="#FF2C628B" />

    <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="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="RootVisual" 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="M 1,1.5 L 4.5,5 L 8,1.5" 
                                    Stroke="{StaticResource Expander.Static.Glyph}" 
                                    StrokeThickness="2"
                                    SnapsToDevicePixels="false" />
                            </Grid>
                            <ContentPresenter 
                                Grid.Row="1" 
                                HorizontalAlignment="Center"
                                VerticalAlignment="Top"
                                Margin="0,4,0,0" 
                                RecognizesAccessKey="True" 
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Glyph}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Pressed.Glyph}"/>
                        </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 x:Name="RootVisual" 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="M 1,1.5 L 4.5,5 L 8,1.5" 
                                    Stroke="{StaticResource Expander.Static.Glyph}" 
                                    StrokeThickness="2"
                                    SnapsToDevicePixels="false" />
                            </Grid>
                            <ContentPresenter 
                                Grid.Column="1" 
                                HorizontalAlignment="Left" 
                                VerticalAlignment="Center"
                                Margin="4,0,0,0" 
                                RecognizesAccessKey="True" 
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Glyph}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Pressed.Glyph}"/>
                        </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 x:Name="RootVisual" 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="M 1,1.5 L 4.5,5 L 8,1.5" 
                                    Stroke="{StaticResource Expander.Static.Glyph}" 
                                    StrokeThickness="2" 
                                    SnapsToDevicePixels="false" />
                            </Grid>
                            <ContentPresenter 
                                Grid.Row="1"
                                HorizontalAlignment="Center" 
                                VerticalAlignment="Top"
                                Margin="0,4,0,0"
                                RecognizesAccessKey="True" 
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Glyph}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Pressed.Glyph}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="RootVisual" 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="M 1,1.5 L 4.5,5 L 8,1.5"  
                                Stroke="{StaticResource Expander.Static.Glyph}" 
                                StrokeThickness="2"
                                SnapsToDevicePixels="false" />
                            <ContentPresenter 
                                Grid.Column="1" 
                                HorizontalAlignment="Left" 
                                VerticalAlignment="Center"
                                Margin="4,0,0,0" 
                                RecognizesAccessKey="True" 
                                SnapsToDevicePixels="True" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.MouseOver.Glyph}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="arrow" Property="Stroke" Value="{StaticResource Expander.Pressed.Glyph}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{StaticResource Expander.Static.Foreground}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="0,2" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <DockPanel x:Name="RootVisual">
                        <ToggleButton x:Name="HeaderSite" 
                            ContentTemplate="{TemplateBinding HeaderTemplate}" 
                            ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                            Content="{TemplateBinding Header}" 
                            FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" 
                            IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                            Foreground="{TemplateBinding Foreground}"
                            Padding="{TemplateBinding Padding}"
                            FontFamily="{TemplateBinding FontFamily}"
                            FontSize="{TemplateBinding FontSize}"
                            FontStyle="{TemplateBinding FontStyle}"
                            FontStretch="{TemplateBinding FontStretch}"
                            FontWeight="{TemplateBinding FontWeight}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" 
                            DockPanel.Dock="Top" 
                            Style="{StaticResource ExpanderDownHeaderStyle}"
                            BorderBrush="{TemplateBinding BorderBrush}" />
                        <Border x:Name="ExpandSiteBorder" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            Background="{TemplateBinding Background}" 
                            Padding="{TemplateBinding Padding}"
                            Visibility="Collapsed"
                            DockPanel.Dock="Bottom">
                            <ContentPresenter x:Name="ExpandSite" 
                                Focusable="false" 
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Border>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter TargetName="ExpandSiteBorder" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="RootVisual" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter TargetName="ExpandSiteBorder" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
                            <Setter Property="Padding" Value="2,0" />
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter TargetName="ExpandSiteBorder" 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="ExpandSiteBorder" Property="DockPanel.Dock" Value="Left" />
                            <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
                            <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
                            <Setter Property="Padding" Value="2,0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

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


    <Style x:Key="FocusVisual">
        <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>

    <Style x:Key="OptionMarkFocusVisual">
        <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>


    <Style x:Key="GridSplitterPreviewStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Fill="#80000000"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type GridSplitter}"
           TargetType="{x:Type GridSplitter}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="PreviewStyle"
                Value="{StaticResource GridSplitterPreviewStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridSplitter}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <SolidColorBrush x:Key="GroupBox.Border" Color="#FFA3A3A3" />

    <BorderGapMaskConverter x:Key="BorderGapMaskConverter"/>
    
    <Style x:Key="{x:Type GroupBox}" TargetType="{x:Type GroupBox}">
        <Setter Property="BorderBrush" Value="{StaticResource GroupBox.Border}"/>
        <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"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="Transparent"
                                Background="{TemplateBinding Background}"/>
    
                        <Border Grid.Row="1"
                                Grid.RowSpan="3"
                                Grid.ColumnSpan="4"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}">
                            <Border.OpacityMask>
                                <MultiBinding Converter="{StaticResource BorderGapMaskConverter}"
                                              ConverterParameter="7">
                                    <Binding ElementName="Header"
                                             Path="ActualWidth"/>
                                    <Binding RelativeSource="{RelativeSource Self}"
                                             Path="ActualWidth"/>
                                    <Binding RelativeSource="{RelativeSource Self}"
                                             Path="ActualHeight"/>
                                </MultiBinding>
                            </Border.OpacityMask>
                        </Border>
                        
                        <Border x:Name="Header"
                                Padding="3,0,3,0"
                                Grid.Row="0"
                                Grid.RowSpan="2"
                                Grid.Column="1">
                            <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>


    <Style x:Key="{x:Type GroupItem}"
           TargetType="{x:Type GroupItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupItem}">
                    <StackPanel>
                        <ContentPresenter x:Name="PART_Header"/>
                        <ItemsPresenter x:Name="ItemsPresenter" Margin="5,0,0,0"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type HeaderedContentControl}"
           TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                    <StackPanel>
                        <ContentPresenter ContentSource="Header"/>
                        <ContentPresenter/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Hyperlink}"
           TargetType="{x:Type Hyperlink}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"/>
        <Setter Property="TextDecorations"
                Value="Underline"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver"
                     Value="true">
                <Setter Property="Foreground"
                        Value="Red"/>
            </Trigger>
            <Trigger Property="IsEnabled"
                     Value="false">
                <Setter Property="Foreground"
                        Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsEnabled"
                     Value="true">
                <Setter Property="Cursor"
                        Value="Hand"/>
            </Trigger>
        </Style.Triggers>
    </Style> 
    <Style x:Key="{x:Type ItemsControl}"
           TargetType="{x:Type ItemsControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ItemsControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type Label}"
           TargetType="{x:Type Label}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <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 Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Padding="{TemplateBinding Padding}"
                            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="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="ListBorder" 
                     Color="#FFCCCCCC" />



    <Style x:Key="{x:Type ListBox}"
           TargetType="{x:Type ListBox}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush"
                Value="{StaticResource ListBorder}"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <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 Name="Bd"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true"
                            Padding="1">
                        <ScrollViewer Padding="{TemplateBinding Padding}"
                                      Focusable="false">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <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>




    <SolidColorBrush x:Key="Item.Static.Background" Color="#FFFCFCFC" />
    <SolidColorBrush x:Key="Item.Static.Border" Color="#FFFCFCFC" />
    <SolidColorBrush x:Key="Item.MouseOver.Background" Color="#FFF2F7FD" />
    <SolidColorBrush x:Key="Item.MouseOver.Border" Color="#FFB8D6FB" />
    <SolidColorBrush x:Key="Item.SelectedActive.Background" Color="#FFDCEBFE" />
    <SolidColorBrush x:Key="Item.SelectedActive.Border" Color="#FF84ACDD" />
    <SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#FFF2F2F2" />
    <SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FFDADADA" />

    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Padding" Value="4,1" />
        <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="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="Bd" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Background="{TemplateBinding Background}" 
                        Padding="{TemplateBinding Padding}" 
                        SnapsToDevicePixels="true">
                        <ContentPresenter 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="False" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.SelectedInactive.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.SelectedInactive.Border}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="True" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.SelectedActive.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.SelectedActive.Border}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





    <Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}"
           TargetType="{x:Type ScrollViewer}">
        <Setter Property="Focusable"
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid Background="{TemplateBinding Background}"
                          SnapsToDevicePixels="true">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <DockPanel Margin="{TemplateBinding Padding}">
                            <ScrollViewer DockPanel.Dock="Top"
                                          HorizontalScrollBarVisibility="Hidden"
                                          VerticalScrollBarVisibility="Hidden"
                                          Focusable="false">
                                <GridViewHeaderRowPresenter Columns="{Binding Path=TemplatedParent.View.Columns,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderContainerStyle="{Binding Path=TemplatedParent.View.ColumnHeaderContainerStyle,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderTemplate="{Binding Path=TemplatedParent.View.ColumnHeaderTemplate,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderTemplateSelector="{Binding Path=TemplatedParent.View.ColumnHeaderTemplateSelector,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderStringFormat="{Binding Path=TemplatedParent.View.ColumnHeaderStringFormat,RelativeSource={RelativeSource TemplatedParent}}"
                                                            AllowsColumnReorder="{Binding Path=TemplatedParent.View.AllowsColumnReorder,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderContextMenu="{Binding Path=TemplatedParent.View.ColumnHeaderContextMenu,RelativeSource={RelativeSource TemplatedParent}}"
                                                            ColumnHeaderToolTip="{Binding Path=TemplatedParent.View.ColumnHeaderToolTip,RelativeSource={RelativeSource TemplatedParent}}"
                                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </ScrollViewer>
                            <ScrollContentPresenter Name="PART_ScrollContentPresenter"
                                                    KeyboardNavigation.DirectionalNavigation="Local"
                                                    Content="{TemplateBinding Content}"
                                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                                    CanContentScroll="{TemplateBinding CanContentScroll}"
                                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </DockPanel>
                        <ScrollBar Name="PART_HorizontalScrollBar"
                                   Orientation="Horizontal"
                                   Grid.Row="1"
                                   Minimum="0.0"
                                   Maximum="{TemplateBinding ScrollableWidth}"
                                   ViewportSize="{TemplateBinding ViewportWidth}"
                                   Value="{Binding Path=HorizontalOffset,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}"
                                   Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                   Cursor="Arrow"/>
                        <ScrollBar Name="PART_VerticalScrollBar"
                                   Orientation="Vertical"
                                   Grid.Column="1"
                                   Minimum="0.0"
                                   Maximum="{TemplateBinding ScrollableHeight}"
                                   ViewportSize="{TemplateBinding ViewportHeight}"
                                   Value="{Binding Path=VerticalOffset,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}"
                                   Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                   Cursor="Arrow"/>
                        <DockPanel Grid.Column="1"
                                   Grid.Row="1"
                                   Background="{Binding Path=Background,ElementName=PART_VerticalScrollBar}"
                                   LastChildFill="false">
                            <Rectangle DockPanel.Dock="Left"
                                       Width="1"
                                       Fill="White"
                                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                            <Rectangle DockPanel.Dock="Top"
                                       Height="1"
                                       Fill="White"
                                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                        </DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="GridViewColumnHeaderGripper"
           TargetType="{x:Type Thumb}">
        <Setter Property="Canvas.Right"
                Value="-9"/>
        <Setter Property="Width"
                Value="18"/>
        <Setter Property="Height"
                Value="{Binding Path=ActualHeight,RelativeSource={RelativeSource TemplatedParent}}"/>
        <Setter Property="Padding"
                Value="0,3,0,4"/>
        <Setter Property="Background"
                Value="#FF000000"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}"
                            Background="Transparent">
                        <Rectangle HorizontalAlignment="Center"
                                   Width="1"
                                   Fill="{TemplateBinding Background}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="{x:Type GridViewColumnHeader}" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="#FFFFFFFF"/>
        <Setter Property="BorderBrush" Value="#FFDEDFE1"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="2,0,2,0"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="ContentContainer"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}">
                            <ContentPresenter Margin="{TemplateBinding Padding}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              RecognizesAccessKey="True"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                        <Canvas>
                            <Thumb x:Name="PART_HeaderGripper"
                                Style="{StaticResource GridViewColumnHeaderGripper}"
                                Background="Transparent"/>
                        </Canvas>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="ContentContainer" Property="BorderBrush" Value="#FF69BBE3" />
                            <Setter TargetName="ContentContainer" Property="Background" Value="#FFBCECFC" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="ContentContainer" Property="BorderBrush" Value="#FF4F90AE" />
                            <Setter TargetName="ContentContainer" Property="Background" Value="#FF85D2F5" />
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="20"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="ContentContainer" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Border 
                                Background="{TemplateBinding Background}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{TemplateBinding BorderBrush}" />
                            <ControlTemplate.Triggers>
                                <Trigger Property="Height" Value="Auto">
                                    <Setter Property="MinHeight" Value="20"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.5056"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                            <Canvas Name="PART_FloatingHeaderCanvas">
                                <Rectangle Opacity="0.3034"
                                           Fill="#FF000000"
                                           Width="{TemplateBinding ActualWidth}"
                                           Height="{TemplateBinding ActualHeight}" />
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Static GridView.GridViewStyleKey}" TargetType="{x:Type ListView}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <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" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        SnapsToDevicePixels="true">
                        <ScrollViewer 
                            Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}"
                            Focusable="false"
                            Padding="{TemplateBinding Padding}">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <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 x:Key="{x:Static GridView.GridViewItemContainerStyleKey}" TargetType="{x:Type ListViewItem}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Padding" Value="4,1" />
        <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="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border x:Name="Bd" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Background="{TemplateBinding Background}" 
                        Padding="{TemplateBinding Padding}" 
                        SnapsToDevicePixels="true">
                        <GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="False" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.SelectedInactive.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.SelectedInactive.Border}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="True" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.SelectedActive.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.SelectedActive.Border}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <SolidColorBrush x:Key="Menu.Background" Color="#FFF5F5F5" />
    <SolidColorBrush x:Key="Menu.Border" Color="#FF979797" />
    <SolidColorBrush x:Key="MenuItem.TopLevel.Static.Background" Color="#FFEAF1FB" />
    <SolidColorBrush x:Key="MenuItem.TopLevel.Static.Border" Color="#FFEAF1FB" />
    <SolidColorBrush x:Key="MenuItem.TopLevel.Static.Foreground" Color="#FF000000" />
    <SolidColorBrush x:Key="MenuItem.SubLevel.Static.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="MenuItem.SubLevel.Static.Border" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="MenuItem.SubLevel.Static.Foreground" Color="#FF000000" />
    <SolidColorBrush x:Key="MenuItem.Disabled.Foreground" Color="#FF9A9A9A" />
    <SolidColorBrush x:Key="MenuItem.Highlight.Background" Color="#FFD7EFFC" />
    <SolidColorBrush x:Key="MenuItem.Highlight.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="MenuItem.Highlight.Foreground" Color="#FF000000" />     
    <SolidColorBrush x:Key="MenuItem.Pressed.Background" Color="#FFC2E4F6" />
    <SolidColorBrush x:Key="MenuItem.Pressed.Border" Color="#FF2C628B" />
    <SolidColorBrush x:Key="MenuItem.Pressed.Foreground" Color="#FF1E395B" />       
    <SolidColorBrush x:Key="MenuItem.Selected.Glyph" Color="#FF0C12A1" />


    <Style TargetType="{x:Type Menu}">
        <Setter Property="Background" Value="{StaticResource MenuItem.TopLevel.Static.Background}" />
        <Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
        <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
        <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
        <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}" 
                        SnapsToDevicePixels="true">
                        <ItemsPresenter 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
    <Geometry x:Key="DownArrow"> M 0,0 L 3.5,4 L 7,0 Z</Geometry>
    <Geometry x:Key="UpArrow">   M 0,4 L 3.5,0 L 7,4 Z</Geometry>
    <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>


    <Geometry x:Key="Checkmark">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>


    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=SubmenuContent}" TargetType="{x:Type ContentControl}">
        <Border
            Background="{StaticResource Menu.Background}"
            BorderBrush="{StaticResource Menu.Border}"
            BorderThickness="1"
            Padding="2">
            <Border
                Background="{StaticResource MenuItem.SubLevel.Static.Background}">
                <ContentPresenter/>
            </Border>
        </Border>
    </ControlTemplate>

    <Style x:Key="MenuScrollButton" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}" >
        <Setter Property="ClickMode" Value="Hover"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="templateRoot"
                        SnapsToDevicePixels="true"
                        Background="Transparent"
                        BorderBrush="Transparent"
                        BorderThickness="1">
                        <ContentPresenter
                            Margin="6"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource MenuItem.Highlight.Background}" />
                            <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Highlight.Border}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{x:Null}">
        <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.Column="0"
                            Grid.Row="1">
                            <ScrollContentPresenter
                                Margin="{TemplateBinding Padding}"
                                CanContentScroll="{TemplateBinding CanContentScroll}"/>
                        </Border>
                        <RepeatButton
                            Grid.Column="0"
                            Grid.Row="0"
                            Style="{StaticResource MenuScrollButton}"
                            Command="{x:Static ScrollBar.LineUpCommand}"
                            CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                            Focusable="false">
                            <RepeatButton.Visibility>
                                <MultiBinding ConverterParameter="0" Converter="{StaticResource MenuScrollingVisibilityConverter}" 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
                                Data="{StaticResource UpArrow}"
                                Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
                        </RepeatButton>
                        <RepeatButton
                            Grid.Column="0"
                            Grid.Row="2"
                            Style="{StaticResource MenuScrollButton}"
                            Command="{x:Static ScrollBar.LineDownCommand}"
                            CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                            Focusable="false">
                            <RepeatButton.Visibility>
                                <MultiBinding ConverterParameter="100" Converter="{StaticResource MenuScrollingVisibilityConverter}" 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
                                Data="{StaticResource DownArrow}"
                                Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
                        </RepeatButton>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}"
           TargetType="{x:Type Separator}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
        <Setter Property="MinHeight"
                Value="1"/>
        <Setter Property="SnapsToDevicePixels"
                Value="true"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Margin="30,0,0,0"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="templateRoot"
            SnapsToDevicePixels="true"
            BorderThickness="{TemplateBinding BorderThickness}"
            Background="{TemplateBinding Background}"
            BorderBrush="{TemplateBinding BorderBrush}">
            <Grid VerticalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Width="16"
                    Height="16"
                    Margin="3" />
                <Path x:Name="GlyphPanel"
                    Data="{StaticResource Checkmark}"
                    FlowDirection="LeftToRight"
                    Margin="3"
                    Visibility="Collapsed"
                    VerticalAlignment="Center"
                    Fill="{TemplateBinding MenuItem.Foreground}" />
                <ContentPresenter
                    Grid.Column="1"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    Margin="{TemplateBinding Padding}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </Grid>
        </Border>
        <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="templateRoot" Property="Background" Value="{StaticResource MenuItem.Highlight.Background}" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Highlight.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Highlight.Foreground}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource MenuItem.Pressed.Background}" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Pressed.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Pressed.Foreground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MenuItem.Pressed.Foreground}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Disabled.Foreground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MenuItem.Disabled.Foreground}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="templateRoot"
            SnapsToDevicePixels="true"
            BorderThickness="{TemplateBinding BorderThickness}"
            Background="{TemplateBinding Background}"
            BorderBrush="{TemplateBinding BorderBrush}">
            <Grid VerticalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Width="16"
                    Height="16"
                    Margin="3"/>
                <Path x:Name="GlyphPanel"
                    Data="{StaticResource Checkmark}"
                    FlowDirection="LeftToRight"
                    Margin="3"
                    Visibility="Collapsed"
                    VerticalAlignment="Center"
                    Fill="{TemplateBinding MenuItem.Foreground}" />
                <ContentPresenter
                    Grid.Column="1"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    Margin="{TemplateBinding MenuItem.Padding}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <Popup x:Name="PART_Popup"
                    AllowsTransparency="true"
                    Focusable="false"
                    IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                    PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                    Placement="Bottom"
                    PlacementTarget="{Binding ElementName=templateRoot}" >
                    <Border x:Name="SubMenuBorder"
                        Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}"
                        BorderBrush="{StaticResource Menu.Border}"
                        BorderThickness="1"
                        Padding="2">
                        <ScrollViewer x:Name="SubMenuScrollViewer"
                            Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                    <Rectangle
                                        Name="OpaqueRect"
                                        Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}"
                                        Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}"
                                        Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                </Canvas>
                                <Rectangle HorizontalAlignment="Left"
                                           Width="1"
                                           Margin="29,2,0,2"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                <ItemsPresenter x:Name="ItemsPresenter"
                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                    KeyboardNavigation.TabNavigation="Cycle"
                                    Grid.IsSharedSizeScope="true"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <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 Property="IsHighlighted" Value="True">
                <Setter TargetName="templateRoot" Property="Background" Value="Transparent" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Highlight.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Highlight.Foreground}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource MenuItem.Pressed.Background}" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Pressed.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Pressed.Foreground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MenuItem.Pressed.Foreground}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Disabled.Foreground}" />
                <Setter TargetName="GlyphPanel" Property="Fill" Value="{StaticResource MenuItem.Disabled.Foreground}" />
            </Trigger>
            <Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false" >
                <Setter TargetName="OpaqueRect"  Property="Canvas.Top"  Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="templateRoot"
            SnapsToDevicePixels="true"
            Height="22"
            BorderThickness="{TemplateBinding BorderThickness}"
            Background="{TemplateBinding Background}"
            BorderBrush="{TemplateBinding BorderBrush}">
            <Grid Margin="-1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="13"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="20"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Width="16"
                    Height="16"
                    Margin="3"/>
                <Border x:Name="GlyphPanel"
                    Visibility="Hidden"
                    Height="22"
                    Width="22"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Background="{StaticResource MenuItem.Highlight.Background}"
                    BorderBrush="{StaticResource MenuItem.Highlight.Border}"
                    BorderThickness="1"
                    Margin="-1,0,0,0">
                    <Path x:Name="Glyph"
                        Data="{StaticResource Checkmark}"
                        FlowDirection="LeftToRight"
                        Height="11"
                        Width="9"
                        Fill="{StaticResource MenuItem.Selected.Glyph}" />
                </Border>
                <ContentPresenter x:Name="menuHeaderContainer"
                    Grid.Column="2"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    Margin="{TemplateBinding MenuItem.Padding}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <TextBlock x:Name="menuGestureText"
                    Grid.Column="4"
                    Text="{TemplateBinding InputGestureText}"
                    Margin="{TemplateBinding MenuItem.Padding}"
                    VerticalAlignment="Center"
                    Opacity="0.7" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter Property="Visibility" TargetName="Icon" 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="templateRoot" Property="Background" Value="Transparent" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Highlight.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Highlight.Foreground}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Disabled.Foreground}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource MenuItem.Disabled.Foreground}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="templateRoot"
            SnapsToDevicePixels="true"
            Height="22"
            BorderThickness="{TemplateBinding BorderThickness}"
            Background="{TemplateBinding Background}"
            BorderBrush="{TemplateBinding BorderBrush}">
            <Grid Margin="-1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="22" SharedSizeGroup="MenuItemIconColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="13"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
                    <ColumnDefinition Width="20"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                    ContentSource="Icon"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Width="16"
                    Height="16"
                    Margin="3"/>
                <Border x:Name="GlyphPanel"
                    BorderThickness="1"
                    Height="22"
                    Width="22"
                    Visibility="Hidden"
                    VerticalAlignment="Center"
                    Margin="-1,0,0,0"
                    BorderBrush="{StaticResource MenuItem.Highlight.Border}"
                    Background="{StaticResource MenuItem.Highlight.Background}">
                    <Path x:Name="Glyph"
                        Data="{DynamicResource Checkmark}"
                        FlowDirection="LeftToRight"
                        Height="11"
                        Width="9"
                        Fill="{StaticResource MenuItem.Selected.Glyph}" />
                </Border>
                <ContentPresenter
                    Grid.Column="2"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    ContentSource="Header"
                    RecognizesAccessKey="True"
                    Margin="{TemplateBinding MenuItem.Padding}"
                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                <TextBlock
                    Grid.Column="4"
                    Text="{TemplateBinding InputGestureText}"
                    VerticalAlignment="Center"
                    Margin="{TemplateBinding MenuItem.Padding}"
                    Opacity="0.7" />
                <Path x:Name="RightArrow"
                    Grid.Column="5"
                    Data="{StaticResource RightArrow}"
                    Margin="10,0,0,0"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Left"
                    Fill="{TemplateBinding MenuItem.Foreground}" />
                <Popup x:Name="PART_Popup"
                    AllowsTransparency="true"
                    Focusable="false"
                    IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
                    PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                    Placement="Right"
                    HorizontalOffset="-2"
                    VerticalOffset="-3">
                    <Border x:Name="SubMenuBorder"
                        Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}"
                        BorderBrush="{StaticResource Menu.Border}"
                        BorderThickness="1"
                        Padding="2">
                        <ScrollViewer x:Name="SubMenuScrollViewer"
                            Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                            <Grid RenderOptions.ClearTypeHint="Enabled">
                                <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                    <Rectangle
                                        Name="OpaqueRect"
                                        Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}"
                                        Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}"
                                        Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                </Canvas>
                                <Rectangle HorizontalAlignment="Left"
                                           Width="1"
                                           Margin="29,2,0,2"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                <ItemsPresenter x:Name="ItemsPresenter"
                                    KeyboardNavigation.DirectionalNavigation="Cycle"
                                    KeyboardNavigation.TabNavigation="Cycle"
                                    Grid.IsSharedSizeScope="true"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <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 Property="IsHighlighted" Value="True">
                <Setter TargetName="templateRoot" Property="Background" Value="Transparent" />
                <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource MenuItem.Highlight.Border}" />
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Highlight.Foreground}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{StaticResource MenuItem.Disabled.Foreground}" />
                <Setter TargetName="Glyph" Property="Fill" Value="{StaticResource MenuItem.Disabled.Foreground}" />
                <Setter TargetName="RightArrow" Property="Fill" Value="{StaticResource MenuItem.Disabled.Foreground}" />
            </Trigger>
            <Trigger SourceName="SubMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false" >
                <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type MenuItem}">
        <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="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}}" />
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Background" Value="{StaticResource MenuItem.TopLevel.Static.Background}" />
                <Setter Property="BorderBrush" Value="{StaticResource MenuItem.TopLevel.Static.Border}" />
                <Setter Property="Foreground" Value="{StaticResource MenuItem.TopLevel.Static.Foreground}" />
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}}" />
                <Setter Property="Padding" Value="6,0"/>
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Background" Value="{StaticResource MenuItem.TopLevel.Static.Background}" />
                <Setter Property="BorderBrush" Value="{StaticResource MenuItem.TopLevel.Static.Border}" />
                <Setter Property="Foreground" Value="{StaticResource MenuItem.TopLevel.Static.Foreground}" />
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}}" />
                <Setter Property="Padding" Value="6,0"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>




    <JournalEntryUnifiedViewConverter x:Key="JournalEntryUnifiedViewConverter"/>

    <LinearGradientBrush x:Key="NavigationWindowNavigationButtonFillEnabled"
                         StartPoint="0.5,0.0"
                         EndPoint="0.5,1.0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFFFFF" Offset="0.0"/>
                <GradientStop Color="#CCD4E9" Offset="0.1"/>
                <GradientStop Color="#4881D2" Offset="0.47"/>
                <GradientStop Color="#001A5A" Offset="0.47"/>
                <GradientStop Color="#007BD6" Offset="0.70"/>
                <GradientStop Color="#54DAFF" Offset="0.85"/>
                <GradientStop Color="#86FFFF" Offset="0.95"/>
                <GradientStop Color="#FFFFFF" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationButtonFillHover"
                         StartPoint="0.5,0.0"
                         EndPoint="0.5,1.0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFFFFF" Offset="0.0"/>
                <GradientStop Color="#DFEDF9" Offset="0.1"/>
                <GradientStop Color="#3086E1" Offset="0.47"/>
                <GradientStop Color="#003B91" Offset="0.47"/>
                <GradientStop Color="#1793EF" Offset="0.70"/>
                <GradientStop Color="#5AD4FF" Offset="0.85"/>
                <GradientStop Color="#BDFFFF" Offset="0.95"/>
                <GradientStop Color="#FFFFFF" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationButtonFillPressed"
                         StartPoint="0.5,0.0"
                         EndPoint="0.5,1.0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#C0D2F5" Offset="0.0"/>
                <GradientStop Color="#5E7A9C" Offset="0.47"/>
                <GradientStop Color="#00062D" Offset="0.47"/>
                <GradientStop Color="#005F9F" Offset="0.70"/>
                <GradientStop Color="#1FA4E2" Offset="0.85"/>
                <GradientStop Color="#61DAFF" Offset="0.95"/>
                <GradientStop Color="#48CFFF" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationButtonFillDisabled"
                         StartPoint="0.5,0.0"
                         EndPoint="0.5,1.0">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFFFFF" Offset="0"/>
                <GradientStop Color="#EBEEF5" Offset="0.5"/>
                <GradientStop Color="#D8DDEB" Offset="0.5"/>
                <GradientStop Color="#DFE2F0" Offset="1.0"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationButtonStrokeEnabled"
                         StartPoint="0,0" 
                         EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#6C90C4" Offset="0"/>
                <GradientStop Color="#315BB4" Offset="0.5"/>
                <GradientStop Color="#002091" Offset="0.5"/>
                <GradientStop Color="#08377C" Offset="1"/>
            </GradientStopCollection>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationArrowStrokeEnabled"
                         StartPoint="0,0" 
                         EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#8AB1FB" Offset="0"/>
            <GradientStop Color="#002874" Offset="1"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationArrowFill"
                         StartPoint="0,0" 
                         EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#FFFFFF" Offset="0.5"/>
                <GradientStop Color="#EEEEEE" Offset="0.5"/>
                <GradientStop Color="#B0B0B0" Offset="1"/>
            </GradientStopCollection>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowDownArrowFill"
                         StartPoint="0,0" 
                         EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="#33B5DA" Offset="0"/>
                <GradientStop Color="#335799" Offset="1"/>
            </GradientStopCollection>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="NavigationWindowNavigationChromeBackground"
                         StartPoint="0,0"
                         EndPoint="0,1">
        <GradientBrush.GradientStops>
            <GradientStop Color="#FFFFFF" Offset="0"/>
            <GradientStop Color="#E3E8F4" Offset="0.5"/>
            <GradientStop Color="#CFD7EB" Offset="0.5"/>
            <GradientStop Color="#E9ECFA" Offset="1.0"/>
        </GradientBrush.GradientStops>
    </LinearGradientBrush>

    <SolidColorBrush x:Key="CurrentEntryBackground" 
                     Color="{StaticResource {x:Static SystemColors.HighlightColorKey}}"
                     Opacity="0.25"/>

    <Style x:Key="NavigationWindowNavigationButtonJournalEntryStyle"
           TargetType="{x:Type MenuItem}">
        <Setter Property="OverridesDefaultStyle" 
                Value="true"/>
        <Setter Property="Header"
                Value="{Binding Path=(JournalEntry.Name)}"/>
        <Setter Property="Command"
                Value="NavigationCommands.NavigateJournal"/>
        <Setter Property="CommandTarget"
                Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Menu}}, Path=TemplatedParent}"/>
        <Setter Property="CommandParameter"
                Value="{Binding RelativeSource={RelativeSource Self}}"/>
        <Setter Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                Value="{Binding (JournalEntryUnifiedViewConverter.JournalEntryPosition)}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type MenuItem}">
                    <Grid Name="Panel"
                          Background="Transparent"
                          SnapsToDevicePixels="true">
                        <Path Name="Glyph"
                              SnapsToDevicePixels="false"
                              Margin="7,5"
                              Width="10"
                              Height="10"
                              HorizontalAlignment="Left"
                              StrokeStartLineCap="Triangle"
                              StrokeEndLineCap="Triangle"
                              StrokeThickness="2"
                              Stroke="{TemplateBinding Foreground}"/>
                        <ContentPresenter ContentSource="Header"
                                          Margin="24,5,21,5"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                                 Value="Current">
                            <Setter TargetName="Panel"
                                    Property="Background"
                                    Value="{StaticResource CurrentEntryBackground}"/>
                            <Setter TargetName="Glyph"
                                    Property="Data"
                                    Value="M 0,5 L 2.5,8 L 7,3 "/>
                            <Setter TargetName="Glyph"
                                    Property="FlowDirection"
                                    Value="LeftToRight"/>
                            <Setter TargetName="Glyph"
                                    Property="StrokeLineJoin"
                                    Value="Miter"/>
                        </Trigger>
                        <Trigger Property="IsHighlighted"
                                 Value="true">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                            <Setter TargetName="Panel"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                        </Trigger>

                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="MenuItem.IsHighlighted"
                                           Value="true"/>
                                <Condition Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                                           Value="Forward"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Glyph"
                                    Property="Stroke"
                                    Value="White"/>
                            <Setter TargetName="Glyph"
                                    Property="Data"
                                    Value="M 1,5 L 7,5 M 5,1 L 9,5 L 5,9"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="MenuItem.IsHighlighted"
                                           Value="true"/>
                                <Condition Property="JournalEntryUnifiedViewConverter.JournalEntryPosition"
                                           Value="Back"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Glyph"
                                    Property="Stroke"
                                    Value="White"/>
                            <Setter TargetName="Glyph"
                                    Property="Data"
                                    Value="M 9,5 L 3,5 M 5,1 L 1,5 L 5,9"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NavigationWindowMenuItem" 
           TargetType="{x:Type MenuItem}">
        <Setter Property="OverridesDefaultStyle" 
                Value="true"/>
        <Setter Property="ScrollViewer.PanningMode"
                Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type MenuItem}">
                    <Grid>
                        <Popup x:Name="PART_Popup"
                                   AllowsTransparency="true"
                                   Placement="Bottom"
                                   VerticalOffset="2"
                                   IsOpen="{Binding Path=(MenuItem.IsSubmenuOpen),RelativeSource={RelativeSource TemplatedParent}}"
                                   Focusable="false"
                                   PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
                            <theme:SystemDropShadowChrome Name="Shdw"
                                                          Color="Transparent">
                                <Border Name="SubMenuBorder"
                                        Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}"
                                        BorderThickness="1"
                                        BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">

                                    <ScrollViewer Name="SubMenuScrollViewer"
                                                  Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                      <Grid RenderOptions.ClearTypeHint="Enabled">
                                        <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                            <Rectangle
                                                Name="OpaqueRect"
                                                Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}" 
                                                Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}" 
                                                Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                        </Canvas>
                                        <ItemsPresenter Name="ItemsPresenter" Margin="2"
                                                        KeyboardNavigation.TabNavigation="Cycle"
                                                        KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                      </Grid>
                                    </ScrollViewer>
                                </Border>
                            </theme:SystemDropShadowChrome>
                        </Popup>
                        
                        <Grid x:Name="Panel" 
                              Width="26" 
                              Background="Transparent"
                              HorizontalAlignment="Right" >
   
                            <Border SnapsToDevicePixels="True" 
                                    Visibility="Hidden" 
                                    Name="HighlightBorder" 
                                    BorderThickness="1,1,1,1" 
                                    BorderBrush="#B0B5BACE" 
                                    CornerRadius="2" >
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1" >
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Color="#20DDDDDD" Offset="0" />
                                            <GradientStop Color="#80FFFFFF" Offset="1" />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <Border BorderBrush="#A0FFFFFF" CornerRadius="1.5" BorderThickness="1" />
                            </Border>

                            <Path x:Name="Arrow"
                                  SnapsToDevicePixels="false"
                                  HorizontalAlignment="Right"
                                  VerticalAlignment="Center"
                                  Margin="{TemplateBinding Padding}"
                                  Fill="{StaticResource NavigationWindowDownArrowFill}"
                                  Stroke="White"
                                  StrokeThickness="1"
                                  StrokeLineJoin="Round"
                                  Data="M 0 0 L 4.5 5 L 9 0 Z"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="true">
                            <Setter TargetName="HighlightBorder" 
                                    Property="Visibility" 
                                    Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Arrow" 
                                    Property="Fill" 
                                    Value="#A5AABE"/>
                        </Trigger>
                        <Trigger SourceName="PART_Popup"
                                 Property="Popup.HasDropShadow"
                                 Value="true">
                            <Setter TargetName="Shdw"
                                    Property="Margin"
                                    Value="0,0,5,5"/>
                            <Setter TargetName="Shdw"
                                    Property="SnapsToDevicePixels"
                                    Value="true"/>
                            <Setter TargetName="Shdw"
                                    Property="Color"
                                    Value="#71000000"/>
                        </Trigger>
                        <Trigger SourceName="SubMenuScrollViewer"
                                 Property="ScrollViewer.CanContentScroll"
                                 Value="false" >
                            <Setter TargetName="OpaqueRect" 
                                    Property="Canvas.Top" 
                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                            <Setter TargetName="OpaqueRect" 
                                    Property="Canvas.Left" 
                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NavigationWindowMenu"
           TargetType="{x:Type Menu}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <DockPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="OverridesDefaultStyle" 
                Value="true"/>
        <Setter Property="KeyboardNavigation.TabNavigation"
                Value="None"/>
        <Setter Property="IsMainMenu" 
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <ItemsPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="NavigationWindowBackButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" 
                Value="true"/>
        <Setter Property="Command" 
                Value="NavigationCommands.BrowseBack"/>
        <Setter Property="Focusable" 
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="24" 
                          Height="24"
                          Background="Transparent">
                        <Ellipse Name="Circle"
                                 StrokeThickness="1"
                                 Fill="{StaticResource NavigationWindowNavigationButtonFillEnabled}"
                                 Stroke="{StaticResource NavigationWindowNavigationButtonStrokeEnabled}" />

                        <Path Name="Arrow" 
                              VerticalAlignment="Center" 
                              HorizontalAlignment="Center" 
                              StrokeThickness="0.75"
                              Data="M0.37,7.69 L5.74,14.20 A1.5,1.5,0,1,0,10.26,12.27 L8.42,10.42 14.90,10.39 A1.5,1.5,0,1,0,14.92,5.87 L8.44,5.90 10.31,4.03 A1.5,1.5,0,1,0,5.79,1.77 z"
                              Stroke="{StaticResource NavigationWindowNavigationArrowStrokeEnabled}"
                              Fill="{StaticResource NavigationWindowNavigationArrowFill}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Fill"
                                    Value="{StaticResource NavigationWindowNavigationButtonFillDisabled}"
                                    TargetName="Circle"/>
                            <Setter Property="Stroke"
                                    Value="#B5BACE"
                                    TargetName="Circle"/>
                            <Setter Property="Stroke"
                                    Value="#B0B5BACE"
                                    TargetName="Arrow"/>
                            <Setter Property="Fill"
                                    Value="#D0FFFFFF"
                                    TargetName="Arrow"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" 
                                 Value="true">
                            <Setter Property="Fill" 
                                    Value="{StaticResource NavigationWindowNavigationButtonFillHover}"
                                    TargetName="Circle"/>
                        </Trigger>
                        <Trigger Property="IsPressed" 
                                 Value="true">
                            <Setter Property="Fill"
                                    Value="{StaticResource NavigationWindowNavigationButtonFillPressed}"
                                    TargetName="Circle"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="NavigationWindowForwardButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="OverridesDefaultStyle" 
                Value="true"/>
        <Setter Property="Command" 
                Value="NavigationCommands.BrowseForward"/>
        <Setter Property="Focusable" 
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Width="24" 
                          Height="24"
                          Background="Transparent">
                        <Ellipse Name="Circle"
                                 Grid.Column="0"      
                                 StrokeThickness="1"
                                 Fill="{StaticResource NavigationWindowNavigationButtonFillEnabled}"
                                 Stroke="{StaticResource NavigationWindowNavigationButtonStrokeEnabled}" />

                        <Path Name="Arrow" 
                              Grid.Column="0"      
                              VerticalAlignment="Center" 
                              HorizontalAlignment="Center" 
                              StrokeThickness="0.75"
                              Data="M0.37,7.69 L5.74,14.20 A1.5,1.5,0,1,0,10.26,12.27 L8.42,10.42 14.90,10.39 A1.5,1.5,0,1,0,14.92,5.87 L8.44,5.90 10.31,4.03 A1.5,1.5,0,1,0,5.79,1.77 z"
                              Stroke="{StaticResource NavigationWindowNavigationArrowStrokeEnabled}"
                              Fill="{StaticResource NavigationWindowNavigationArrowFill}"
                              RenderTransformOrigin="0.5,0">
                            <Path.RenderTransform>
                                <ScaleTransform ScaleX="-1" />
                            </Path.RenderTransform>
                        </Path>

                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" 
                                 Value="false">
                            <Setter Property="Fill"
                                    Value="{StaticResource NavigationWindowNavigationButtonFillDisabled}"
                                    TargetName="Circle"/>
                            <Setter Property="Stroke"
                                    Value="#B5BACE"
                                    TargetName="Circle"/>
                            <Setter Property="Stroke"
                                    Value="#B0B5BACE"
                                    TargetName="Arrow"/>
                            <Setter Property="Fill"
                                    Value="#D0FFFFFF"
                                    TargetName="Arrow"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" 
                                 Value="true">
                            <Setter Property="Fill" 
                                    Value="{StaticResource NavigationWindowNavigationButtonFillHover}"
                                    TargetName="Circle"/>
                        </Trigger>
                        <Trigger Property="IsPressed" 
                                 Value="true">
                            <Setter Property="Fill"
                                    Value="{StaticResource NavigationWindowNavigationButtonFillPressed}"
                                    TargetName="Circle"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <ControlTemplate x:Key="NavigationWindowTemplateKey"
                     TargetType="{x:Type NavigationWindow}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <DockPanel>
                <Grid Name="NavChrome"
                      Background="{StaticResource NavigationWindowNavigationChromeBackground}"
                      DockPanel.Dock="Top"
                      Height="30">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="29"/>
                        <ColumnDefinition Width="26"/>
                        <ColumnDefinition Width="17"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Menu Name="NavMenu"
                          Grid.ColumnSpan="3"
                          Height="23"
                          Margin="1,0,0,1"
                          VerticalAlignment="Center" 
                          Style="{StaticResource NavigationWindowMenu}">

                        <MenuItem Padding="0,2,5,0"
                                  Style="{StaticResource NavigationWindowMenuItem}"
                                  ItemContainerStyle="{StaticResource NavigationWindowNavigationButtonJournalEntryStyle}"
                                  IsSubmenuOpen="{Binding Path=(MenuItem.IsSubmenuOpen),Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}">
                            <MenuItem.ItemsSource>
                                <MultiBinding Converter="{StaticResource JournalEntryUnifiedViewConverter}">
                                    <MultiBinding.Bindings>
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" 
                                                 Path="(NavigationWindow.BackStack)" />
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" 
                                                 Path="(NavigationWindow.ForwardStack)" />
                                    </MultiBinding.Bindings>
                                </MultiBinding>
                            </MenuItem.ItemsSource>
                        </MenuItem>
                    </Menu>

                    <Path Grid.Column="0" 
                          SnapsToDevicePixels="false"
                          IsHitTestVisible="false"
                          Margin="2,0,0,0"
                          Grid.ColumnSpan="3"
                          StrokeThickness="1" 
                          HorizontalAlignment="Left" 
                          VerticalAlignment="Center" 
                          Data="M22.5767,21.035 Q27,19.37 31.424,21.035 A12.5,12.5,0,0,0,53.5,13 A12.5,12.5,0,0,0,37.765,0.926 Q27,4.93 16.235,0.926 A12.5,12.5,0,0,0,0.5,13 A12.5,12.5,0,0,0,22.5767,21.035 z">
                        <Path.Fill>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStopCollection>
                                        <GradientStop Color="#A0C2CCE7" Offset="0"/>
                                        <GradientStop Color="#60FFFFFF" Offset="1"/>
                                    </GradientStopCollection>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Path.Fill>

                        <Path.Stroke>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStopCollection>
                                        <GradientStop Color="#FFB7C2E3" Offset="0.2"/>
                                        <GradientStop Color="#A0FFFFFF" Offset="0.9"/>
                                    </GradientStopCollection>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Path.Stroke>
                    </Path>

                    <Button Style="{StaticResource NavigationWindowBackButtonStyle}"
                            Margin="3,0,2,0" 
                            Grid.Column="0"/>
                    

                    <Button Style="{StaticResource NavigationWindowForwardButtonStyle}"
                            Margin="2,0,0,0" 
                            Grid.Column="1"/>
                </Grid>
                <Grid>
                    <AdornerDecorator>                    
                        <ContentPresenter Name="PART_NavWinCP" 
                                          ClipToBounds="true"/>
                                          
                    </AdornerDecorator>


                    <ResizeGrip x:Name="WindowResizeGrip"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom"
                                Visibility="Collapsed"
                                IsTabStop="false"/>
                </Grid>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="ShowsNavigationUI" Value="False">
                <Setter TargetName="NavChrome" Property="Visibility" Value="Collapsed"/>
            </Trigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Window.ResizeMode"
                               Value="CanResizeWithGrip"/>
                    <Condition Property="Window.WindowState"
                               Value="Normal"/>
                </MultiTrigger.Conditions>
                <Setter TargetName="WindowResizeGrip"
                        Property="Visibility"
                        Value="Visible"/>
            </MultiTrigger>

            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="NavigationWindow.CanGoForward"
                               Value="false"/>
                    <Condition Property="NavigationWindow.CanGoBack"
                               Value="false"/>
                </MultiTrigger.Conditions>
                <Setter TargetName="NavMenu"
                        Property="IsEnabled"
                        Value="false"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type NavigationWindow}"
           TargetType="{x:Type NavigationWindow}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="Template"
                Value="{StaticResource NavigationWindowTemplateKey}"/>
    </Style>




 
   
    <Style x:Key="{x:Type Page}"
           TargetType="{x:Type Page}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Page}">
                    <Border Background="{TemplateBinding Background}">
                        <ContentPresenter Content="{TemplateBinding Page.Content}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


	<SolidColorBrush x:Key="ProgressBar.Progress" Color="#FF00D228" />
	<SolidColorBrush x:Key="ProgressBar.Background" Color="#FFDBDBDB" />
	<SolidColorBrush x:Key="ProgressBar.Border" Color="#FFA1A1A1" />

	<Style TargetType="{x:Type ProgressBar}">
		<Setter Property="Foreground" Value="{StaticResource ProgressBar.Progress}" />
		<Setter Property="Background" Value="{StaticResource ProgressBar.Background}" />
		<Setter Property="BorderBrush" Value="{StaticResource ProgressBar.Border}" />
		<Setter Property="BorderThickness" Value="1" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ProgressBar}">
					<Grid x:Name="TemplateRoot">
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Determinate"/>
								<VisualState x:Name="Indeterminate">
									<Storyboard RepeatBehavior="Forever">
										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
											<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
											<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
											<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
										</DoubleAnimationUsingKeyFrames>
										<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
											<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
											<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
											<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
										</PointAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>
						<Border 
						    BorderThickness="{TemplateBinding BorderThickness}" 
						    BorderBrush="{TemplateBinding BorderBrush}" 
						    Background="{TemplateBinding Background}" />
						<Rectangle x:Name="PART_Track"/>
						<Grid x:Name="PART_Indicator"
						    HorizontalAlignment="Left"
						    ClipToBounds="true">
							<Rectangle x:Name="Indicator" 
							    Fill="{TemplateBinding Foreground}" />
							<Rectangle x:Name="Animation" 
							    RenderTransformOrigin="0.5,0.5" 
							    Fill="{TemplateBinding Foreground}">
								<Rectangle.RenderTransform>
									<TransformGroup>
										<ScaleTransform/>
										<SkewTransform/>
										<RotateTransform/>
										<TranslateTransform/>
									</TransformGroup>
								</Rectangle.RenderTransform>
							</Rectangle>
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="Orientation" Value="Vertical">
							<Setter Property="LayoutTransform" TargetName="TemplateRoot">
								<Setter.Value>
									<RotateTransform Angle="-90"/>
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="IsIndeterminate" Value="true">
							<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

    
    <SolidColorBrush x:Key="ResizeGripperForeground" Color="#FFAFAFAF" />


    <Style x:Key="{x:Type ResizeGrip}"
           TargetType="{x:Type ResizeGrip}">
        <Setter Property="MinWidth"
                Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinHeight"
                Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ResizeGrip}">
                    <Grid SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
                        <Path HorizontalAlignment="Right" 
                              VerticalAlignment="Bottom" 
                              Margin="0,0,2,2"
                              Data="M 9,0 L 11,0 L 11,11 L 0,11 L 0,9 L 3,9 L 3,6 L 6,6 L 6,3 L 9,3 z">

                            <Path.Fill>
                                <DrawingBrush Viewbox="0,0,3,3"
                                              Viewport="0,0,3,3"
                                              TileMode="Tile"
                                              ViewportUnits="Absolute"
                                              ViewboxUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="{StaticResource ResizeGripperForeground}"
                                                                 Geometry="M 0,0 L 2,0 L 2,2 L 0,2 z "/>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Path.Fill>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <SolidColorBrush x:Key="ScrollBar.Static.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="ScrollBar.Static.Border" Color="#FFBFBFBF" />
    <SolidColorBrush x:Key="ScrollBar.MouseOver.Background" Color="#FFBDE6FD" />
    <SolidColorBrush x:Key="ScrollBar.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="ScrollBar.Pressed.Background" Color="#FFC2E4F6" />
    <SolidColorBrush x:Key="ScrollBar.Pressed.Border" Color="#FF2C628B" />
    
    <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 x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="border" 
                        BorderThickness="1" 
                        SnapsToDevicePixels="true" 
                        Background="{StaticResource ScrollBar.Static.Background}" 
                        BorderBrush="{StaticResource ScrollBar.Static.Border}">
                        <ContentPresenter x:Name="contentPresenter" 
                            Margin="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            Focusable="False" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="border" Property="Background" Value="{StaticResource ScrollBar.MouseOver.Background}" />
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource ScrollBar.MouseOver.Border}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="border" Property="Background" Value="{StaticResource ScrollBar.Pressed.Background}" />
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource ScrollBar.Pressed.Border}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <theme:ScrollChrome 
                        ScrollGlyph="VerticalGripper"
                        RenderMouseOver="{TemplateBinding IsMouseOver}"
                        RenderPressed="{TemplateBinding IsDragging}"
                        SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ScrollBarThumbHorizontal" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <theme:ScrollChrome 
                        ScrollGlyph="HorizontalGripper"
                        RenderMouseOver="{TemplateBinding IsMouseOver}"
                        RenderPressed="{TemplateBinding IsDragging}"
                        SnapsToDevicePixels="true"/>
                </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="{StaticResource ScrollBar.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource ScrollBar.Static.Border}" />
        <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 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Grid.Row="1" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" />
                        <RepeatButton 
                            Command="{x:Static ScrollBar.LineUpCommand}" 
                            IsEnabled="{TemplateBinding IsMouseOver}" 
                            Style="{StaticResource ScrollBarButton}">
                            <Path 
                                Data="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" 
                                Stretch="Uniform" 
                                Margin="3,4,3,3" 
                                Fill="{TemplateBinding TextElement.Foreground}" />
                        </RepeatButton>
                        <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 
                            Command="{x:Static ScrollBar.LineDownCommand}" 
                            IsEnabled="{TemplateBinding IsMouseOver}" 
                            Grid.Row="2" 
                            Style="{StaticResource ScrollBarButton}">
                            <Path 
                                Data="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" 
                                Stretch="Uniform" 
                                Margin="3,4,3,3" 
                                Fill="{TemplateBinding TextElement.Foreground}" />
                        </RepeatButton>
                    </Grid>
                </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 
                                    BorderThickness="{TemplateBinding BorderThickness}" 
                                    Grid.Column="1" 
                                    Background="{TemplateBinding Background}" 
                                    BorderBrush="{TemplateBinding BorderBrush}" />
                                <RepeatButton 
                                    Command="{x:Static ScrollBar.LineLeftCommand}" 
                                    IsEnabled="{TemplateBinding IsMouseOver}" 
                                    Style="{StaticResource ScrollBarButton}">
                                    <Path 
                                        Data="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" 
                                        Stretch="Uniform" 
                                        Margin="3" 
                                        Fill="{TemplateBinding TextElement.Foreground}" />
                                </RepeatButton>
                                <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 ScrollBarThumbHorizontal}" />
                                    </Track.Thumb>
                                </Track>
                                <RepeatButton 
                                    Grid.Column="2" 
                                    Command="{x:Static ScrollBar.LineRightCommand}" 
                                    IsEnabled="{TemplateBinding IsMouseOver}" 
                                    Style="{StaticResource ScrollBarButton}">
                                    <Path 
                                        Data="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" 
                                        Stretch="Uniform" 
                                        Margin="3" 
                                        Fill="{TemplateBinding TextElement.Foreground}" />
                                </RepeatButton>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>


 
    <Style x:Key="{x:Type ScrollViewer}" 
           TargetType="{x:Type ScrollViewer}">
        <Style.Triggers>
            <Trigger Property="IsEnabled" 
                     Value="false">
                <Setter Property="Foreground" 
                        Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>
 
    <Style x:Key="{x:Type Separator}"
           TargetType="{x:Type Separator}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
        <Setter Property="Margin"
                Value="0,2,0,2"/>
        <Setter Property="Focusable"
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true"
                            Height="1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <SolidColorBrush x:Key="SliderThumb.Static.Background" Color="#FFDDDDDD" />
    <SolidColorBrush x:Key="SliderThumb.Static.Border" Color="#FF707070" />
    <SolidColorBrush x:Key="SliderThumb.Static.Foreground" Color="#FFB0B0B0" />
    <SolidColorBrush x:Key="SliderThumb.MouseOver.Background" Color="#FFBEE6FD" />
    <SolidColorBrush x:Key="SliderThumb.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="SliderThumb.Pressed.Background" Color="#FFC4E5F6" />
    <SolidColorBrush x:Key="SliderThumb.Pressed.Border" Color="#FF2C628B" />
    <SolidColorBrush x:Key="SliderThumb.Disabled.Background" Color="#FFF4F4F4" />
    <SolidColorBrush x:Key="SliderThumb.Disabled.Border" Color="#FFADB2B5" />
    <SolidColorBrush x:Key="SliderThumb.Track.Background" Color="#FFE7EAEA" />
    <SolidColorBrush x:Key="SliderThumb.Track.Border" Color="#FFB0B0B0" />

    <ControlTemplate x:Key="SliderThumbHorizontalDefault" TargetType="{x:Type Thumb}">
     <Grid 
         HorizontalAlignment="Center" 
         VerticalAlignment="Center" 
         UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M 0,0 C0,0 11,0 11,0 11,0 11,18 11,18 11,18 0,18 0,18 0,18 0,0 0,0 z" 
             SnapsToDevicePixels="True" 
             StrokeThickness="1" 
             VerticalAlignment="Center" 
             UseLayoutRounding="True" 
             Stretch="Fill"
             Fill="{StaticResource SliderThumb.Static.Background}"
             Stroke="{StaticResource SliderThumb.Static.Border}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderThumbHorizontalTop" TargetType="{x:Type Thumb}">
     <Grid 
         HorizontalAlignment="Center" 
         VerticalAlignment="Center" 
         UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M 0,6 C0,6 5.5,0 5.5,0 5.5,0 11,6 11,6 11,6 11,18 11,18 11,18 0,18 0,18 0,18 0,6 0,6 z" 
             SnapsToDevicePixels="True" 
             StrokeThickness="1" 
             VerticalAlignment="Center" 
             UseLayoutRounding="True" 
             Stretch="Fill"
             Fill="{StaticResource SliderThumb.Static.Background}"
             Stroke="{StaticResource SliderThumb.Static.Border}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderThumbHorizontalBottom" TargetType="{x:Type Thumb}">
     <Grid HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M 0,12 C0,12 5.5,18 5.5,18 5.5,18 11,12 11,12 11,12 11,0 11,0 11,0 0,0 0,0 0,0 0,12 0,12 z" 
             SnapsToDevicePixels="True" 
             StrokeThickness="1" 
             VerticalAlignment="Center" 
             UseLayoutRounding="True" 
             Stretch="Fill"
             Fill="{StaticResource SliderThumb.Static.Background}"
             Stroke="{StaticResource SliderThumb.Static.Border}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderHorizontal" TargetType="{x:Type Slider}">
        <Border x:Name="border" 
                 SnapsToDevicePixels="True"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}">
             <Grid>
                 <Grid.RowDefinitions>
                     <RowDefinition Height="Auto"/>
                     <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                     <RowDefinition Height="Auto"/>
                 </Grid.RowDefinitions>
                 <TickBar x:Name="TopTick" 
                     Height="4" 
                     Placement="Top" 
                     Grid.Row="0" 
                     Visibility="Collapsed" 
                     Margin="0,0,0,2" 
                     Fill="{TemplateBinding Foreground}" />
                 <TickBar x:Name="BottomTick" 
                     Height="4" 
                     Placement="Bottom" 
                     Grid.Row="2" 
                     Visibility="Collapsed" 
                     Margin="0,2,0,0" 
                     Fill="{TemplateBinding Foreground}" />
                 <Border x:Name="TrackBackground" 
                     BorderThickness="1" 
                     Height="4.0" 
                     Margin="5,0" 
                     Grid.Row="1" 
                     VerticalAlignment="center"
                     BorderBrush="{StaticResource SliderThumb.Track.Border}" 
                     Background="{StaticResource SliderThumb.Track.Background}">
                     <Canvas Margin="-6,-1">
                         <Rectangle x:Name="PART_SelectionRange" 
                             Height="4.0" 
                             Visibility="Hidden" 
                             Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                     </Canvas>
                 </Border>
                 <Track x:Name="PART_Track" Grid.Row="1">
                     <Track.DecreaseRepeatButton>
                         <RepeatButton 
                             Command="{x:Static Slider.DecreaseLarge}" 
                             Style="{StaticResource RepeatButtonTransparent}"/>
                     </Track.DecreaseRepeatButton>
                     <Track.IncreaseRepeatButton>
                         <RepeatButton 
                             Command="{x:Static Slider.IncreaseLarge}" 
                             Style="{StaticResource RepeatButtonTransparent}"/>
                     </Track.IncreaseRepeatButton>
                     <Track.Thumb>
                         <Thumb x:Name="Thumb" 
                             OverridesDefaultStyle="True" 
                             Focusable="False" 
                             VerticalAlignment="Center" 
                             Template="{StaticResource SliderThumbHorizontalDefault}" 
                             Width="11" 
                             Height="18"/>
                     </Track.Thumb>
                 </Track>
             </Grid>
        </Border>
     <ControlTemplate.Triggers>
         <Trigger Property="TickPlacement" Value="TopLeft">
             <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
             <Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbHorizontalTop}"/>
             <Setter Property="Margin" TargetName="TrackBackground" Value="5,2,5,0"/>
         </Trigger>
         <Trigger Property="TickPlacement" Value="BottomRight">
             <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
             <Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbHorizontalBottom}"/>
             <Setter Property="Margin" TargetName="TrackBackground" Value="5,0,5,2"/>
         </Trigger>
         <Trigger Property="TickPlacement" Value="Both">
             <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
             <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
         </Trigger>
         <Trigger Property="IsSelectionRangeEnabled" Value="true">
             <Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
         </Trigger>
         <Trigger Property="IsKeyboardFocused" Value="true">
             <Setter Property="Foreground" TargetName="Thumb" Value="Blue"/>
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderThumbVerticalDefault" TargetType="{x:Type Thumb}">
     <Grid 
         HorizontalAlignment="Center" 
         VerticalAlignment="Center" 
         UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M0.5,0.5 L18.5,0.5 18.5,11.5 0.5,11.5z" 
             Stretch="Fill"
             Stroke="{StaticResource SliderThumb.Static.Border}"
             Fill="{StaticResource SliderThumb.Static.Background}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderThumbVerticalLeft" TargetType="{x:Type Thumb}">
     <Grid 
         HorizontalAlignment="Center" 
         VerticalAlignment="Center" 
         UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M 6,11 C6,11 0,5.5 0,5.5 0,5.5 6,0 6,0 6,0 18,0 18,0 18,0 18,11 18,11 18,11 6,11 6,11 z" 
             Stretch="Fill"
             Stroke="{StaticResource SliderThumb.Static.Border}"
             Fill="{StaticResource SliderThumb.Static.Background}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderThumbVerticalRight" TargetType="{x:Type Thumb}">
     <Grid 
         HorizontalAlignment="Center" 
         VerticalAlignment="Center" 
         UseLayoutRounding="True">
         <Path x:Name="grip" 
             Data="M 12,11 C12,11 18,5.5 18,5.5 18,5.5 12,0 12,0 12,0 0,0 0,0 0,0 0,11 0,11 0,11 12,11 12,11 z" 
             Stretch="Fill"
             Stroke="{StaticResource SliderThumb.Static.Border}"
             Fill="{StaticResource SliderThumb.Static.Background}" />
     </Grid>
     <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.MouseOver.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.MouseOver.Border}" />
         </Trigger>
         <Trigger Property="IsDragging" Value="true">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Pressed.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Pressed.Border}" />
         </Trigger>
         <Trigger Property="IsEnabled" Value="false">
             <Setter TargetName="grip" Property="Fill" Value="{StaticResource SliderThumb.Disabled.Background}" />
             <Setter TargetName="grip" Property="Stroke" Value="{StaticResource SliderThumb.Disabled.Border}" />
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SliderVertical" TargetType="{x:Type Slider}">
        <Border x:Name="border" 
                 SnapsToDevicePixels="True"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}">
             <Grid>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="Auto"/>
                     <ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
                     <ColumnDefinition Width="Auto"/>
                 </Grid.ColumnDefinitions>
                 <TickBar x:Name="TopTick" 
                     Grid.Column="0" 
                     Placement="Left" 
                     Visibility="Collapsed" 
                     Width="4" 
                     Margin="0,0,2,0" 
                     Fill="{TemplateBinding Foreground}" />
                 <TickBar x:Name="BottomTick" 
                     Grid.Column="2" 
                     Placement="Right" 
                     Visibility="Collapsed" 
                     Width="4" 
                     Margin="2,0,0,0" 
                     Fill="{TemplateBinding Foreground}" />
                 <Border x:Name="TrackBackground" 
                     BorderThickness="1" 
                     Grid.Column="1" 
                     HorizontalAlignment="center" 
                     Margin="0,5" 
                     Width="4.0" 
                     BorderBrush="{StaticResource SliderThumb.Track.Border}" 
                     Background="{StaticResource SliderThumb.Track.Background}">
                     <Canvas Margin="-1,-6">
                         <Rectangle x:Name="PART_SelectionRange" 
                             Visibility="Hidden" 
                             Width="4.0" 
                             Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                     </Canvas>
                 </Border>
                 <Track x:Name="PART_Track" Grid.Column="1">
                     <Track.DecreaseRepeatButton>
                         <RepeatButton 
                             Command="{x:Static Slider.DecreaseLarge}" 
                             Style="{StaticResource RepeatButtonTransparent}"/>
                     </Track.DecreaseRepeatButton>
                     <Track.IncreaseRepeatButton>
                         <RepeatButton 
                             Command="{x:Static Slider.IncreaseLarge}" 
                             Style="{StaticResource RepeatButtonTransparent}"/>
                     </Track.IncreaseRepeatButton>
                     <Track.Thumb>
                         <Thumb x:Name="Thumb" 
                             OverridesDefaultStyle="True" 
                             Focusable="False" 
                             VerticalAlignment="Top" 
                             Width="18" 
                             Height="11" 
                             Template="{StaticResource SliderThumbVerticalDefault}"/>
                     </Track.Thumb>
                 </Track>
             </Grid>
         </Border>
     <ControlTemplate.Triggers>
         <Trigger Property="TickPlacement" Value="TopLeft">
             <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
             <Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbVerticalLeft}"/>
             <Setter Property="Margin" TargetName="TrackBackground" Value="2,5,0,5"/>
         </Trigger>
         <Trigger Property="TickPlacement" Value="BottomRight">
             <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
             <Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbVerticalRight}"/>
             <Setter Property="Margin" TargetName="TrackBackground" Value="0,5,2,5"/>
         </Trigger>
         <Trigger Property="TickPlacement" Value="Both">
             <Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
             <Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
         </Trigger>
         <Trigger Property="IsSelectionRangeEnabled" Value="true">
             <Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
         </Trigger>
         <Trigger Property="IsKeyboardFocused" Value="true">
             <Setter Property="Foreground" TargetName="Thumb" Value="Blue"/>
         </Trigger>
     </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Slider}">
     <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
     <Setter Property="Background" Value="Transparent" />
     <Setter Property="BorderBrush" Value="Transparent" />
     <Setter Property="Foreground" Value="{StaticResource SliderThumb.Static.Foreground}" />
     <Setter Property="Template" Value="{StaticResource SliderHorizontal}" />
     <Style.Triggers>
         <Trigger Property="Orientation" Value="Vertical">
             <Setter Property="Template" Value="{StaticResource SliderVertical}" />
         </Trigger>
     </Style.Triggers>
    </Style>


    <Style x:Key="{x:Type StatusBar}"
           TargetType="{x:Type StatusBar}">
        <Setter Property="Background"
                Value="#FFFBFF"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <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 Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Static StatusBar.SeparatorStyleKey}"
           TargetType="{x:Type Separator}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"/>
        <Setter Property="MinWidth"
                Value="1"/>
        <Setter Property="MinHeight"
                Value="1"/>
        <Setter Property="Margin"
                Value="2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type StatusBarItem}"
           TargetType="{x:Type StatusBarItem}">
        <Setter Property="Padding"
                Value="3"/>
        <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}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <SolidColorBrush x:Key="TabItem.Static.Background" Color="#FFEBEBEB" />
    <SolidColorBrush x:Key="TabItem.Static.Border" Color="#FF898C95" />
    <SolidColorBrush x:Key="TabItem.MouseOver.Background" Color="#FFD9F0FC" />
    <SolidColorBrush x:Key="TabItem.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="TabItem.Selected.Border" Color="#FF898C95" />

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Padding" Value="2"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Background" Value="{StaticResource TabItem.Selected.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource TabItem.Selected.Border}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid x:Name="templateRoot" 
                        ClipToBounds="true" 
                        SnapsToDevicePixels="true" 
                        KeyboardNavigation.TabNavigation="Local">
                        <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" 
                            Background="Transparent"
                            Grid.Column="0" 
                            Grid.Row="0"
                            IsItemsHost="true" 
                            Margin="2,2,2,0" 
                            KeyboardNavigation.TabIndex="1" 
                            Panel.ZIndex="1"/>
                        <Border x:Name="contentPanel" 
                            Grid.Column="0" 
                            Grid.Row="1" 
                            KeyboardNavigation.DirectionalNavigation="Contained"
                            KeyboardNavigation.TabNavigation="Local" 
                            KeyboardNavigation.TabIndex="2" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}">
                            <ContentPresenter x:Name="PART_SelectedContentHost"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                              Margin="{TemplateBinding Padding}"
                                              ContentSource="SelectedContent"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="Grid.Row" TargetName="headerPanel" Value="1"/>
                            <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                            <Setter Property="Margin" TargetName="headerPanel" Value="2,0,2,2"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="headerPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="contentPanel" Value="1"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="headerPanel" Value="2,2,0,2"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="headerPanel" Value="1"/>
                            <Setter Property="Grid.Column" TargetName="contentPanel" Value="0"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="headerPanel" Value="0,2,2,2"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Background" Value="{StaticResource TabItem.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource TabItem.Static.Border}" />
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Padding" Value="6,2"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
                        <Border x:Name="mainBorder" 
                            BorderThickness="1" 
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Margin="0">
                            <Border x:Name="innerBorder" 
                                BorderThickness="1" 
                                Background="{StaticResource TabItem.Selected.Background}"
                                BorderBrush="{StaticResource TabItem.Selected.Border}"
                                Margin="-1" 
                                Opacity="0" />
                        </Border>                           
                        <ContentPresenter x:Name="contentPresenter" 
                            ContentSource="Header" 
                            HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" 
                            VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            Focusable="False" 
                            Margin="{TemplateBinding Padding}"
                            RecognizesAccessKey="True"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="mainBorder" Property="Background" Value="{StaticResource TabItem.MouseOver.Background}" />
                            <Setter TargetName="mainBorder" Property="BorderBrush" Value="{StaticResource TabItem.MouseOver.Border}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Panel.ZIndex" Value="1"/>
                            <Setter Property="Margin" Value="-2"/>
                            <Setter TargetName="innerBorder" Property="Opacity" Value="1" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFE2E3EA" />
    <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FFC5DAED" />
    <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FFB5CFE7" />

    <Style x:Key="{x:Type TextBoxBase}" TargetType="{x:Type TextBoxBase}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <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 TextBoxBase}">
                    <Border x:Name="border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="PART_ContentHost" 
                            Focusable="false" 
                            HorizontalScrollBarVisibility="Hidden" 
                            VerticalScrollBarVisibility="Hidden" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="border" Property="Opacity" Value="0.56"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.MouseOver.Border}" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.Focus.Border}" />
                        </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>
    
    <Style x:Key="{x:Type PasswordBox}"
           TargetType="{x:Type PasswordBox}">
        <Setter Property="PasswordChar" Value="●"/>
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <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 PasswordBox}">
                    <Border x:Name="border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="PART_ContentHost" 
                            Focusable="false" 
                            HorizontalScrollBarVisibility="Hidden" 
                            VerticalScrollBarVisibility="Hidden" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="border" Property="Opacity" Value="0.56"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.MouseOver.Border}" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="true">
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.Focus.Border}" />
                        </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>


    <Style x:Key="{x:Type TextBox}"
           BasedOn="{StaticResource {x:Type TextBoxBase}}"
           TargetType="{x:Type TextBox}">
    </Style>
    <Style x:Key="{x:Type RichTextBox}"
           BasedOn="{StaticResource {x:Type TextBoxBase}}"
           TargetType="{x:Type RichTextBox}">
        <Style.Resources>
            <Style x:Key="{x:Type FlowDocument}"
                   TargetType="{x:Type FlowDocument}">
                <Setter Property="OverridesDefaultStyle"
                        Value="true"/>
            </Style>
            <Style x:Key="{x:Type Hyperlink}"
                   BasedOn="{StaticResource {x:Type Hyperlink}}"
                   TargetType="{x:Type Hyperlink}">
                <Style.Triggers>
                    <Trigger Property="IsMouseOver"
                             Value="true">
                        <Setter Property="Foreground"
                                Value="Blue"/>
                    </Trigger>
                    <Trigger Property="IsEnabled"
                             Value="false">
                        <Setter Property="Foreground"
                                Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Style.Resources>
        <Setter Property="MinWidth"
                Value="10"/>
    </Style>


    <Style x:Key="{x:Type Thumb}" TargetType="{x:Type Thumb}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Background" Value="{StaticResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <SolidColorBrush x:Key="ToolTip.Background" Color="#FFF1F2F7" />
    <SolidColorBrush x:Key="ToolTip.Border" Color="#FF767676" />
    <SolidColorBrush x:Key="ToolTip.Foreground" Color="#FF575757" />

    <Style x:Key="{x:Type ToolTip}" TargetType="ToolTip">
        <Setter Property="Background" Value="{StaticResource ToolTip.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource ToolTip.Border}" />
        <Setter Property="Foreground" Value="{StaticResource ToolTip.Foreground}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Padding" Value="6,4" />
        <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="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HasDropShadow" Value="False" />
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Border Name="Border" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        SnapsToDevicePixels="True">
                        <ContentPresenter 
                            Margin="{TemplateBinding Padding}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





    <Style x:Key="{x:Type TreeView}"
           TargetType="{x:Type TreeView}">
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush"
                Value="{StaticResource ListBorder}"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Padding"
                Value="1"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <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 Name="Bd"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true">
                        <ScrollViewer Name="_tv_scrollviewer_"
                                      Background="{TemplateBinding Background}"
                                      Focusable="false"
                                      CanContentScroll="false"
                                      HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                      VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                      Padding="{TemplateBinding Padding}"
                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <ItemsPresenter/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                      <Trigger Property="VirtualizingPanel.IsVirtualizing"
                               Value="true">
                        <Setter TargetName="_tv_scrollviewer_"
                                Property="CanContentScroll"
                                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="TreeViewItemToggleButton_Style" TargetType="ToggleButton">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid Width="15" Height="13" Background="Transparent" Margin="0,1,0,0">
                        <Path x:Name="Collapsed" 
                            Width="5" 
                            Height="9" 
                            Data="M 0,9 C0,9 5,4.5 5,4.5 5,4.5 0,0 0,0 0,0 0,9 0,9 z" 
                            Stretch="Fill" 
                            Stroke="{TemplateBinding Foreground}" 
                            StrokeThickness="1" 
                            Margin="2,1,1,1" 
                            HorizontalAlignment="Left" 
                            VerticalAlignment="Center" 
                            Opacity="0.4" 
                            SnapsToDevicePixels="True" />
                        <Path x:Name="Expanded" 
                            Width="6" 
                            Height="6" 
                            Data="M 0,6 C0,6 6,6 6,6 6,6 6,0 6,0 6,0 0,6 0,6 z" 
                            Fill="#FFA3A3A3" 
                            Stroke="{TemplateBinding Foreground}" 
                            StrokeThickness="1" 
                            Stretch="Fill" 
                            HorizontalAlignment="Left" 
                            VerticalAlignment="Center" 
                            SnapsToDevicePixels="True" 
                            Visibility="Hidden" 
                            Margin="1,2,1,1"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Collapsed" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="Expanded" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </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="SnapsToDevicePixels" Value="True" />
        <Setter Property="Padding" Value="4,1" />
        <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="18" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" MinHeight="21"/>
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Border Name="Border"
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Grid.ColumnSpan="2" />
                        <Border x:Name="Bd" 
                            Grid.Column="1" 
                            Margin="{TemplateBinding Padding}">
                            <ContentPresenter x:Name="PART_Header" 
                                ContentSource="Header" 
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                VerticalAlignment="Center"/>
                        </Border>
                        <ToggleButton x:Name="Expander" 
                            Style="{StaticResource TreeViewItemToggleButton_Style}" 
                            ClickMode="Press" 
                            IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" 
                            Foreground="{TemplateBinding Foreground}"/>
                        <ItemsPresenter x:Name="ItemsHost" 
                            Grid.Row="1" 
                            Grid.Column="1" 
                            Visibility="Collapsed" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="Bd" Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
                        </Trigger>
                        <Trigger SourceName="Expander" Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelectionActive" Value="False" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource Item.SelectedInactive.Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Item.SelectedInactive.Border}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelectionActive" Value="True" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource Item.SelectedActive.Background}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Item.SelectedActive.Border}" />
                        </MultiTrigger>                     
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsExpanded" Value="True" />
                                <Condition Property="HasItems" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ItemsHost" Property="Visibility" Value="Visible" />
                        </MultiTrigger>
                        <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>
                            <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
                        </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>
                    </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="{x:Type UserControl}"
           TargetType="{x:Type UserControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type UserControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


   
    <ControlTemplate x:Key="WindowTemplateKey"
                     TargetType="{x:Type Window}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <Grid>
                <AdornerDecorator>
                    <ContentPresenter/>
                </AdornerDecorator>

                <ResizeGrip x:Name="WindowResizeGrip"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Bottom"
                            Visibility="Collapsed"
                            IsTabStop="false"/>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="Window.ResizeMode"
                               Value="CanResizeWithGrip"/>
                    <Condition Property="Window.WindowState"
                               Value="Normal"/>
                </MultiTrigger.Conditions>
                <Setter TargetName="WindowResizeGrip"
                        Property="Visibility"
                        Value="Visible"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>


    <Style x:Key="{x:Type Window}"
           TargetType="{x:Type Window}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <AdornerDecorator>
                            <ContentPresenter/>
                        </AdornerDecorator>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Window.ResizeMode"
                     Value="CanResizeWithGrip">
                <Setter Property="Template"
                        Value="{StaticResource WindowTemplateKey}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <JournalEntryListConverter x:Key="NavigationWindowDropDownLimiter"/>

    <Style x:Key="BrowserWindowNavigationButtonJournalEntryStyle"
           TargetType="{x:Type MenuItem}">
        <Setter Property="Header"
                Value="{Binding Path=Name}"/>
        <Setter Property="Command"
                Value="NavigationCommands.NavigateJournal"/>
        <Setter Property="CommandTarget"
                Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}}"/>
        <Setter Property="CommandParameter"
                Value="{Binding RelativeSource={RelativeSource Self}}"/>
    </Style>




    <Style x:Key="BrowserWindowMenuItem"
           TargetType="{x:Type MenuItem}">
        <Setter Property="Margin"
                Value="0"/>
        <Setter Property="ScrollViewer.PanningMode"
                Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type MenuItem}">
                    <DockPanel x:Name="Panel"
                               Background="Transparent">
                        <Popup x:Name="PART_Popup"
                               AllowsTransparency="true"
                               Placement="Bottom"
                               IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
                               Focusable="false"
                               PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
                            <theme:SystemDropShadowChrome Name="Shdw"
                                                          Color="Transparent">
                                <Border Name="SubMenuBorder"
                                        Background="{DynamicResource {x:Static SystemColors.MenuBrushKey}}"
                                        BorderThickness="1"
                                        BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
                                    <ScrollViewer Name="SubMenuScrollViewer"
                                                  Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                      <Grid RenderOptions.ClearTypeHint="Enabled">
                                        <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                            <Rectangle
                                                Name="OpaqueRect"
                                                Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}" 
                                                Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}" 
                                                Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                        </Canvas>
                                        <ItemsPresenter Name="ItemsPresenter" Margin="2"
                                                        KeyboardNavigation.TabNavigation="Cycle"
                                                        KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                      </Grid>
                                    </ScrollViewer>
                                </Border>
                            </theme:SystemDropShadowChrome>
                        </Popup>
                        <Path x:Name="Arrow"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              Margin="0 2 0 0"
                              Fill="white"
                              Stroke="#AAAAAA"
                              StrokeThickness="1"
                              Data="{StaticResource DownArrow}"/>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSuspendingPopupAnimation"
                                 Value="true">
                            <Setter TargetName="PART_Popup"
                                    Property="PopupAnimation"
                                    Value="None"/>
                        </Trigger>
                       
                        <Trigger Property="IsHighlighted"
                                 Value="true">
                            <Setter TargetName="Arrow"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                            <Setter TargetName="Panel"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                        </Trigger>

                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Arrow"
                                    Property="Fill"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <Trigger SourceName="PART_Popup"
                                 Property="Popup.HasDropShadow"
                                 Value="true">
                            <Setter TargetName="Shdw"
                                    Property="Margin"
                                    Value="0,0,5,5"/>
                            <Setter TargetName="Shdw"
                                    Property="SnapsToDevicePixels"
                                    Value="true"/>
                            <Setter TargetName="Shdw"
                                    Property="Color"
                                    Value="#71000000"/>
                        </Trigger>
                        <Trigger SourceName="SubMenuScrollViewer"
                                 Property="ScrollViewer.CanContentScroll"
                                 Value="false" >
                            <Setter TargetName="OpaqueRect" 
                                    Property="Canvas.Top" 
                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                            <Setter TargetName="OpaqueRect" 
                                    Property="Canvas.Left" 
                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="BrowserWindowMenu"
           TargetType="{x:Type Menu}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <DockPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Padding"
                Value="0,0,0,0"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="IsMainMenu" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <ItemsPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

  

  
    <Style x:Key="NavigationChromeDownLevelBackButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="Margin"
                Value="0,0,0,0"/>
        <Setter Property="IsEnabled"
                Value="false"/>
        <Setter Property="Command"
                Value="NavigationCommands.BrowseBack"/>
        <Setter Property="Focusable"
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <DockPanel>
                        <Rectangle DockPanel.Dock="Right"
                                   x:Name="R1"
                                   Width="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Bottom"
                                   x:Name="B1"
                                   Height="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Left"
                                   x:Name="L1"
                                   Width="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Top"
                                   x:Name="T1"
                                   Height="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Viewbox Grid.Column="0"
                                     Grid.Row="0">
                                <Grid Width="50"
                                      Height="50"
                                      Margin="15,0,0,0">
                                    <Ellipse x:Name="EllipseBackground"
                                             Opacity="1"
                                             StrokeThickness="2">
                                        <Ellipse.Fill>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="#B3E2A2"
                                                                      Offset="0"/>
                                                        <GradientStop Color="#25B40E"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Fill>
                                        <Ellipse.Stroke>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="black"
                                                                      Offset="0"/>
                                                        <GradientStop Color="#ccffffff"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Stroke>
                                    </Ellipse>
                                    <Ellipse x:Name="EllipseShine"
                                             Stroke="transparent"
                                             Margin="5,5,5,15">
                                        <Ellipse.Fill>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="#aaffffff"
                                                                      Offset="0"/>
                                                        <GradientStop Color="transparent"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Fill>
                                    </Ellipse>
                                    <Path x:Name="Arrow"
                                          Fill="white"
                                          Stroke="#086403"
                                          Data="M0.5,20.468c0.002,0.34,0.036,0.679,0.102,1.013c0.032,0.162,0.092,0.312,0.139,0.468    c0.052,0.176,0.092,0.355,0.163,0.527c0.076,0.183,0.18,0.349,0.274,0.521c0.073,0.132,0.131,0.27,0.216,0.397    c0.196,0.294,0.418,0.568,0.667,0.817l14.611,14.611c2.083,2.083,5.459,2.083,7.542,0c2.083-2.083,2.083-5.459,0-7.542    l-5.509-5.509h23.791c2.945,0,5.333-2.388,5.333-5.333c0-2.946-2.388-5.333-5.333-5.333H18.732l5.509-5.509    c2.083-2.083,2.083-5.459,0-7.542c-2.083-2.083-5.459-2.083-7.542,0L2.203,16.549c-0.043,0.04-0.095,0.07-0.136,0.111    c-0.002,0.002-0.005,0.003-0.007,0.006c-0.002,0.002-0.003,0.004-0.005,0.006c-0.246,0.247-0.465,0.517-0.659,0.807    c-0.088,0.132-0.149,0.275-0.224,0.413c-0.092,0.167-0.192,0.328-0.266,0.505c-0.072,0.175-0.114,0.357-0.167,0.538    c-0.045,0.153-0.104,0.299-0.135,0.458C0.536,19.732,0.5,20.075,0.5,20.419c0,0.006-0.002,0.012-0.002,0.019    C0.498,20.448,0.5,20.458,0.5,20.468z">
                                        <Path.RenderTransform>
                                            <TransformGroup>
                                                <TransformGroup.Children>
                                                    <TransformCollection>
                                                        <ScaleTransform ScaleX="0.65"
                                                                        ScaleY="0.65"/>
                                                        <TranslateTransform X="11.5"
                                                                            Y="10"/>
                                                    </TransformCollection>
                                                </TransformGroup.Children>
                                            </TransformGroup>
                                        </Path.RenderTransform>
                                    </Path>
                                </Grid>
                            </Viewbox>
                            <DockPanel Grid.Column="1"
                                       Grid.Row="0">
                                <Rectangle DockPanel.Dock="Right"
                                           x:Name="R2"
                                           Width="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Bottom"
                                           x:Name="B2"
                                           Height="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Left"
                                           x:Name="L2"
                                           Width="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Top"
                                           x:Name="T2"
                                           Height="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                                <Grid Width="10">
                                    <Menu Style="{StaticResource BrowserWindowMenu}">
                                        <MenuItem x:Name="NavWinMenu"
                                                  Style="{StaticResource BrowserWindowMenuItem}"
                                                  ItemContainerStyle="{StaticResource BrowserWindowNavigationButtonJournalEntryStyle}"
                                                  ItemsSource="{Binding Path=BackStack,Converter={StaticResource NavigationWindowDropDownLimiter},Mode=OneTime,RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}}"
                                                  IsSubmenuOpen="{Binding Path=(MenuItem.IsSubmenuOpen),Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
                                    </Menu>
                                </Grid>
                            </DockPanel>
                        </Grid>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Path.Fill"
                                    TargetName="EllipseBackground">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="white"
                                                              Offset="0"/>
                                                <GradientStop Color="gray"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsEnabled" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="EllipseBackground"
                                    Property="Path.Fill">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#25B40E"
                                                              Offset="0"/>
                                                <GradientStop Color="#086403"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="NavWinMenu"
                                    Property="Background"
                                    Value="Transparent">
                            </Setter>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="L1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="R1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="T1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="B1"/>
                        </MultiTrigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter TargetName="EllipseBackground"
                                    Property="Path.Fill">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#25B40E"
                                                              Offset="0"/>
                                                <GradientStop Color="#086403"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="Arrow"
                                    Property="Path.RenderTransform">
                                <Setter.Value>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <ScaleTransform ScaleX="0.65"
                                                                ScaleY="0.65"/>
                                                <TranslateTransform X="10"
                                                                    Y="12"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="EllipseShine"
                                    Property="Path.RenderTransform">
                                <Setter.Value>
                                    <TranslateTransform X="0"
                                                        Y="2"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="MenuItem.IsSubmenuOpen"
                                 Value="true">
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="L2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="R2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="T2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="B2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NavigationChromeDownLevelForwardButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="Margin"
                Value="0,0,0,0"/>
        <Setter Property="IsEnabled"
                Value="false"/>
        <Setter Property="Command"
                Value="NavigationCommands.BrowseForward"/>
        <Setter Property="Focusable"
                Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <DockPanel>
                        <Rectangle DockPanel.Dock="Right"
                                   x:Name="R1"
                                   Width="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Bottom"
                                   x:Name="B1"
                                   Height="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Left"
                                   x:Name="L1"
                                   Width="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                        <Rectangle DockPanel.Dock="Top"
                                   x:Name="T1"
                                   Height="1"
                                   Visibility="Hidden"
                                   Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Viewbox Grid.Column="0"
                                     Grid.Row="0">
                                <Grid Width="50"
                                      Height="50"
                                      Margin="15,0,0,0">
                                    <Ellipse x:Name="EllipseBackground"
                                             Opacity="1"
                                             StrokeThickness="2">
                                        <Ellipse.Fill>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="#B3E2A2"
                                                                      Offset="0"/>
                                                        <GradientStop Color="#25B40E"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Fill>
                                        <Ellipse.Stroke>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="black"
                                                                      Offset="0"/>
                                                        <GradientStop Color="#ccffffff"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Stroke>
                                    </Ellipse>
                                    <Ellipse x:Name="EllipseShine"
                                             Stroke="transparent"
                                             Margin="5,3,5,15">
                                        <Ellipse.Fill>
                                            <LinearGradientBrush StartPoint="0,0"
                                                                 EndPoint="0,1">
                                                <GradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="#aaffffff"
                                                                      Offset="0"/>
                                                        <GradientStop Color="transparent"
                                                                      Offset="1"/>
                                                    </GradientStopCollection>
                                                </GradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Ellipse.Fill>
                                    </Ellipse>
                                    <Path x:Name="Arrow"
                                          Fill="white"
                                          Stroke="#086403"
                                          Data="M47.82,20.407c-0.002-0.34-0.036-0.679-0.102-1.013c-0.032-0.162-0.092-0.312-0.139-0.468    c-0.052-0.176-0.092-0.355-0.163-0.527c-0.076-0.183-0.18-0.349-0.274-0.521c-0.073-0.132-0.131-0.27-0.216-0.397    c-0.196-0.294-0.418-0.568-0.667-0.817L31.647,2.053c-2.083-2.083-5.459-2.083-7.542,0c-2.083,2.083-2.083,5.459,0,7.542    l5.509,5.509H5.823c-2.945,0-5.333,2.388-5.333,5.333c0,2.946,2.388,5.333,5.333,5.333h23.765l-5.509,5.509    c-2.083,2.083-2.083,5.459,0,7.542c2.083,2.083,5.459,2.083,7.542,0l14.497-14.497c0.043-0.04,0.095-0.07,0.136-0.111    c0.002-0.002,0.005-0.003,0.007-0.006c0.002-0.002,0.003-0.004,0.005-0.006c0.246-0.247,0.465-0.517,0.659-0.807    c0.088-0.132,0.149-0.275,0.224-0.413c0.092-0.167,0.192-0.328,0.266-0.505c0.072-0.175,0.114-0.357,0.167-0.538    c0.045-0.153,0.104-0.299,0.135-0.458c0.067-0.339,0.103-0.682,0.104-1.026c0-0.006,0.002-0.012,0.002-0.019    C47.823,20.427,47.82,20.417,47.82,20.407z">
                                        <Path.RenderTransform>
                                            <TransformGroup>
                                                <TransformGroup.Children>
                                                    <TransformCollection>
                                                        <ScaleTransform ScaleX="0.65"
                                                                        ScaleY="0.65"/>
                                                        <TranslateTransform X="8.5"
                                                                            Y="10"/>
                                                    </TransformCollection>
                                                </TransformGroup.Children>
                                            </TransformGroup>
                                        </Path.RenderTransform>
                                    </Path>
                                </Grid>
                            </Viewbox>
                            <DockPanel Grid.Column="1"
                                       Grid.Row="0">
                                <Rectangle DockPanel.Dock="Right"
                                           x:Name="R2"
                                           Width="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Bottom"
                                           x:Name="B2"
                                           Height="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Left"
                                           x:Name="L2"
                                           Width="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                                <Rectangle DockPanel.Dock="Top"
                                           x:Name="T2"
                                           Height="1"
                                           Visibility="Hidden"
                                           Fill="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
                                <Grid Width="10">
                                    <Menu Style="{StaticResource BrowserWindowMenu}">
                                        <MenuItem x:Name="NavWinMenu"
                                                  Style="{StaticResource BrowserWindowMenuItem}"
                                                  ItemContainerStyle="{StaticResource BrowserWindowNavigationButtonJournalEntryStyle}"
                                                  ItemsSource="{Binding Path=ForwardStack,Converter={StaticResource NavigationWindowDropDownLimiter},Mode=OneTime,RelativeSource={RelativeSource AncestorType={x:Type NavigationWindow}}}"
                                                  IsSubmenuOpen="{Binding Path=(MenuItem.IsSubmenuOpen),Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
                                    </Menu>
                                </Grid>
                            </DockPanel>
                        </Grid>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Path.Fill"
                                    TargetName="EllipseBackground">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="white"
                                                              Offset="0"/>
                                                <GradientStop Color="gray"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsEnabled" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="EllipseBackground"
                                    Property="Path.Fill">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#25B40E"
                                                              Offset="0"/>
                                                <GradientStop Color="#086403"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="NavWinMenu"
                                    Property="Background"
                                    Value="Transparent">
                            </Setter>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="L1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="R1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="T1"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="B1"/>
                        </MultiTrigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter TargetName="EllipseBackground"
                                    Property="Path.Fill">
                                <Setter.Value>
                                    <LinearGradientBrush StartPoint="0,0"
                                                         EndPoint="0,1">
                                        <GradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#25B40E"
                                                              Offset="0"/>
                                                <GradientStop Color="#086403"
                                                              Offset="1"/>
                                            </GradientStopCollection>
                                        </GradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="Arrow"
                                    Property="Path.RenderTransform">
                                <Setter.Value>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <ScaleTransform ScaleX="0.65"
                                                                ScaleY="0.65"/>
                                                <TranslateTransform X="10"
                                                                    Y="12"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="EllipseShine"
                                    Property="Path.RenderTransform">
                                <Setter.Value>
                                    <TranslateTransform X="0"
                                                        Y="2"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="MenuItem.IsSubmenuOpen"
                                 Value="true">
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="L2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="R2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="T2"/>
                            <Setter Property="Visibility"
                                    Value="Visible"
                                    TargetName="B2"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="BrowserHostWindowTemplateKey"
                     TargetType="{x:Type NavigationWindow}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <AdornerDecorator>
                <ContentPresenter Name="PART_NavWinCP" ClipToBounds="true"/>
            </AdornerDecorator>
        </Border>
    </ControlTemplate>
    <Style x:Key="{x:Static SystemParameters.NavigationChromeStyleKey}"
           TargetType="{x:Type NavigationWindow}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="Template"
                Value="{StaticResource BrowserHostWindowTemplateKey}"/>
    </Style>
    <ControlTemplate x:Key="BrowserHostDownLevelWindowTemplateKey"
                     TargetType="{x:Type NavigationWindow}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}">
            <DockPanel>
                <Grid
                      FlowDirection="{x:Static theme:PlatformCulture.FlowDirection}"
                      DockPanel.Dock="Top"
                      Height="30">
                    <Grid.Background>
                        <LinearGradientBrush StartPoint="0,0"
                                             EndPoint="1,0">
                            <GradientBrush.GradientStops>
                                <GradientStopCollection>
                                    <GradientStop Color="silver"
                                                  Offset="0"/>
                                    <GradientStop Color="white"
                                                  Offset="1"/>
                                </GradientStopCollection>
                            </GradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Grid.Background>
                    <DockPanel LastChildFill="false">
                        <Button Style="{StaticResource NavigationChromeDownLevelBackButtonStyle}"
                                DockPanel.Dock="left"
                                Width="40"
                                Button.IsEnabled="{TemplateBinding NavigationWindow.CanGoBack}"/>
                        <Button Style="{StaticResource NavigationChromeDownLevelForwardButtonStyle}"
                                DockPanel.Dock="left"
                                Width="40"
                                Button.IsEnabled="{TemplateBinding NavigationWindow.CanGoForward}"/>
                    </DockPanel>
                </Grid>
                <Border>
                    <AdornerDecorator>
                        <ContentPresenter Name="PART_NavWinCP" ClipToBounds="true"/>
                    </AdornerDecorator>
                </Border>
            </DockPanel>
        </Border>
    </ControlTemplate>
    <Style x:Key="{x:Static SystemParameters.NavigationChromeDownLevelStyleKey}"
           TargetType="{x:Type NavigationWindow}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="Template"
                Value="{StaticResource BrowserHostDownLevelWindowTemplateKey}"/>
        <Style.Triggers>
            <Trigger Property="NavigationWindow.ShowsNavigationUI"
                     Value="false">
                <Setter Property="Template"
                        Value="{StaticResource BrowserHostWindowTemplateKey}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD" />
    <SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070" />
    <SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD" />
    <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6" />
    <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B" />
    <SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4" />
    <SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5" />
    <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383" />

    <Style x:Key="BaseButtonStyle" TargetType="{x:Type ButtonBase}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Border x:Name="border" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        SnapsToDevicePixels="true">
                        <ContentPresenter x:Name="contentPresenter" 
                            RecognizesAccessKey="True" 
                            Margin="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Focusable="False">
                        </ContentPresenter>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource Button.MouseOver.Background}" TargetName="border" />
                            <Setter Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" TargetName="border" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Background" Value="{StaticResource Button.Pressed.Background}" TargetName="border" />
                            <Setter Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" TargetName="border" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" Value="{StaticResource Button.Disabled.Background}" TargetName="border" />
                            <Setter Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" TargetName="border" />
                            <Setter Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" TargetName="contentPresenter" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type ToggleButton}"
           BasedOn="{StaticResource BaseButtonStyle}"
           TargetType="{x:Type ToggleButton}"/>

    <Style x:Key="{x:Type RepeatButton}"
           BasedOn="{StaticResource BaseButtonStyle}"
           TargetType="{x:Type RepeatButton}">
        <Setter Property="Stylus.IsPressAndHoldEnabled"
                Value="false"/>
    </Style>

    <Style x:Key="{x:Type Button}"
           BasedOn="{StaticResource BaseButtonStyle}"
           TargetType="{x:Type Button}"/>




    <SolidColorBrush x:Key="OptionMark.Static.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="OptionMark.Static.Border" Color="#FF707070" />
    <SolidColorBrush x:Key="OptionMark.MouseOver.Background" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="OptionMark.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="OptionMark.MouseOver.Glyph" Color="#FF3C7FB1" />

    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource OptionMark.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource OptionMark.Static.Border}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <Grid x:Name="templateRoot" SnapsToDevicePixels="True" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border x:Name="checkBoxBorder" 
                            Margin="1" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}">
                            <Grid x:Name="markGrid">
                                <Path x:Name="optionMark" Data="M 1,3 C1,3 1,6 1,6 1,6 4,9 4,9 4,9 9,3 9,3 9,3 9,0 9,0 9,0 4,6 4,6 4,6 1,3 1,3 z" Stretch="Uniform" Margin="2,1,1,1" Opacity="0" Fill="{TemplateBinding TextElement.Foreground}" />
                                <Rectangle x:Name="indeterminateMark" Margin="2" Opacity="0" Fill="{TemplateBinding TextElement.Foreground}" />
                            </Grid>
                        </Border>
                        <ContentPresenter x:Name="contentPresenter" 
                            RecognizesAccessKey="True" 
                            Grid.Column="1" 
                            Margin="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            Focusable="False"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
                            <Setter Property="Padding" Value="4,-1,0,0"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource OptionMark.MouseOver.Background}" TargetName="checkBoxBorder" />
                            <Setter Property="BorderBrush" Value="{StaticResource OptionMark.MouseOver.Border}" TargetName="checkBoxBorder" />
                            <Setter Property="Fill" Value="{StaticResource OptionMark.MouseOver.Glyph}" TargetName="optionMark" />
                            <Setter Property="Fill" Value="{StaticResource OptionMark.MouseOver.Glyph}" TargetName="indeterminateMark" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.56" TargetName="templateRoot" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Opacity" Value="1" TargetName="optionMark" />
                            <Setter Property="Opacity" Value="0" TargetName="indeterminateMark" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter Property="Opacity" Value="0" TargetName="optionMark" />
                            <Setter Property="Opacity" Value="0.56" TargetName="indeterminateMark" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    

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

    <Style x:Key="ComboBoxEditableTextBox"
           TargetType="{x:Type TextBox}">
        <Setter Property="OverridesDefaultStyle"
                Value="true"/>
        <Setter Property="AllowDrop"
                Value="true"/>
        <Setter Property="MinWidth"
                Value="0"/>
        <Setter Property="MinHeight"
                Value="0"/>
        <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}">
                    <ScrollViewer x:Name="PART_ContentHost"
                                  Focusable="false"
                                  HorizontalScrollBarVisibility="Hidden"
                                  VerticalScrollBarVisibility="Hidden"
                                  Background="Transparent"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <SolidColorBrush x:Key="ComboBox.Static.Background" Color="#FFDDDDDD" />
    <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FF707070" />
    <SolidColorBrush x:Key="ComboBox.MouseOver.Background" Color="#FFBEE6FD" />
    <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF3C7FB1" />
    <SolidColorBrush x:Key="ComboBox.Pressed.Background" Color="#FFC4E5F6" />
    <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF2C628B" />
    <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF4F4F4" />
    <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFADB2B5" />

    <Style x:Key="ComboBoxToggleButton" 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="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="templateRoot"
                        SnapsToDevicePixels="true"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}">
                        <Border x:Name="splitBorder"
                            HorizontalAlignment="Right"
                            Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
                            BorderThickness="1"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Margin="0,-1,-1,-1">
                            <Path x:Name="arrow"
                                Data="M 0,0 C0,0 3.5,4 3.5,4 3.5,4 7,0 7,0 7,0 0,0 0,0 z"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Fill="{TemplateBinding TextElement.Foreground}">
                            </Path>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.MouseOver.Background}" />
                            <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.MouseOver.Border}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Pressed.Background}" />
                            <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Pressed.Border}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Disabled.Background}" />
                            <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Disabled.Border}" />
                            <Setter TargetName="splitBorder" Property="Background" Value="{StaticResource ComboBox.Disabled.Background}" />
                            <Setter TargetName="splitBorder" Property="BorderBrush" Value="{StaticResource ComboBox.Disabled.Border}" />
                            <Setter TargetName="arrow" Property="Fill" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
        <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
            </Grid.ColumnDefinitions>
            <Popup x:Name="PART_Popup"
                AllowsTransparency="true"
                Placement="Bottom"
                Grid.ColumnSpan="2"
                IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
                PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                <theme:SystemDropShadowChrome x:Name="shadow"
                    Color="Transparent"
                    MaxHeight="{TemplateBinding MaxDropDownHeight}"
                    MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
                    <Border x:Name="dropDownBorder"
                        BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
                        Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
                        BorderThickness="1">
                        <ScrollViewer x:Name="DropDownScrollViewer">
                            <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
                                <Canvas x:Name="canvas"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    Height="0"
                                    Width="0">
                                    <Rectangle x:Name="opaqueRect"
                                        Fill="{Binding Background, ElementName=dropDownBorder}"
                                        Height="{Binding ActualHeight, ElementName=dropDownBorder}"
                                        Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
                                </Canvas>
                                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </theme:SystemDropShadowChrome>
            </Popup>
            <ToggleButton x:Name="toggleButton"
                BorderBrush="{TemplateBinding BorderBrush}"
                Background="{TemplateBinding Background}"
                BorderThickness="{TemplateBinding BorderThickness}"
                IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                Style="{StaticResource ComboBoxToggleButton}"
                Grid.ColumnSpan="2"/>
            <Border x:Name="border"
                Margin="{TemplateBinding BorderThickness}"
                Background="{StaticResource TextBox.Static.Background}">
                <TextBox x:Name="PART_EditableTextBox"
                    Style="{StaticResource ComboBoxEditableTextBox}"
                    IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                    Margin="{TemplateBinding Padding}"
                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="border" Property="Opacity" Value="0.56"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocusWithin" Value="true">
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
            <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
                <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
            </Trigger>
            <Trigger Property="HasItems" Value="false">
                <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
            </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 Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
                <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
                <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
        <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
            </Grid.ColumnDefinitions>
            <Popup x:Name="PART_Popup"
                AllowsTransparency="true"
                Margin="1"
                Placement="Bottom"
                Grid.ColumnSpan="2"
                IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                <theme:SystemDropShadowChrome x:Name="shadow"
                    Color="Transparent"
                    MaxHeight="{TemplateBinding MaxDropDownHeight}"
                    MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
                    <Border x:Name="dropDownBorder"
                        BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
                        Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
                        BorderThickness="1">
                        <ScrollViewer x:Name="DropDownScrollViewer">
                            <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
                                <Canvas x:Name="canvas"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    Height="0"
                                    Width="0">
                                    <Rectangle x:Name="opaqueRect"
                                        Fill="{Binding Background, ElementName=dropDownBorder}"
                                        Height="{Binding ActualHeight, ElementName=dropDownBorder}"
                                        Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
                                </Canvas>
                                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </theme:SystemDropShadowChrome>
            </Popup>
            <ToggleButton x:Name="toggleButton"
                BorderBrush="{TemplateBinding BorderBrush}"
                Background="{TemplateBinding Background}"
                BorderThickness="{TemplateBinding BorderThickness}"
                IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                Style="{StaticResource ComboBoxToggleButton}"
                Grid.ColumnSpan="2" />
            <ContentPresenter x:Name="contentPresenter"
                Content="{TemplateBinding SelectionBoxItem}"
                ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                IsHitTestVisible="false"
                Margin="{TemplateBinding Padding}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
                <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
                <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
            </Trigger>
            <Trigger Property="HasItems" Value="false">
                <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
            </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 Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
                <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
                <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="Padding" Value="6,3,5,3"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}" />
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="true">
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="Padding" Value="2"/>
                <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style TargetType="{x:Type ComboBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Padding" Value="4,1" />
        <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="BorderBrush" Value="Transparent" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border x:Name="Bd" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}" 
                        Background="{TemplateBinding Background}" 
                        Padding="{TemplateBinding Padding}" 
                        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 Item.SelectedActive.Background}" />
                            <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.SelectedActive.Border}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Type ContextMenu}"
           TargetType="{x:Type ContextMenu}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.MenuBrushKey}}" />
        <Setter Property="BorderBrush" Value="{StaticResource Menu.Border}" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
        <Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
        <Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
        <Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
        <Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border Name="Border"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="2">
                        <ScrollViewer Name="ContextMenuScrollViewer"
                                      Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                          <Grid RenderOptions.ClearTypeHint="Enabled">
                            <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                <Rectangle
                                    Name="OpaqueRect"
                                    Height="{Binding ElementName=Border,Path=ActualHeight}"
                                    Width="{Binding ElementName=Border,Path=ActualWidth}"
                                    Fill="{Binding ElementName=Border,Path=Background}" />
                            </Canvas>
                            <Rectangle HorizontalAlignment="Left"
                                       Width="1"
                                       Margin="29,2,0,2"
                                       Fill="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                            <ItemsPresenter Name="ItemsPresenter"
                                Margin="{TemplateBinding Padding}"
                                KeyboardNavigation.DirectionalNavigation="Cycle"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                          </Grid>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger SourceName="ContextMenuScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
                            <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding ElementName=ContextMenuScrollViewer, Path=VerticalOffset}" />
                            <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding ElementName=ContextMenuScrollViewer, Path=HorizontalOffset}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style TargetType="{x:Type DatePicker}">
        <Setter Property="Foreground" Value="#FF333333" />
        <Setter Property="IsTodayHighlighted" Value="True" />
        <Setter Property="SelectedDateFormat" Value="Short" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Padding" Value="2"/>
        <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DatePicker}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}" 
                            Padding="{TemplateBinding Padding}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualState Name="Normal" />
                                <VisualState Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PART_DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border.Child>
                            <Grid x:Name="PART_Root"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <Grid.Resources>
                                    <SolidColorBrush x:Key="DisabledBrush" Color="#A5FFFFFF" />

                                    <ControlTemplate x:Key="DropDownButtonTemplate" TargetType="Button">
                                        <Grid>
                                            <VisualStateManager.VisualStateGroups>
                                                <VisualStateGroup Name="CommonStates">
                                                    <VisualStateGroup.Transitions>
                                                        <VisualTransition GeneratedDuration="0" />
                                                        <VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                                        <VisualTransition To="Pressed" GeneratedDuration="0:0:0.1" />
                                                    </VisualStateGroup.Transitions>
                                                    <VisualState Name="Normal" />
                                                    <VisualState Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FFBEE6FD"/>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState Name="Pressed">
                                                        <Storyboard>
                                                            <ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#FFC4E5F6" />
                                                            <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="00:00:00.001" Storyboard.TargetName="Highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                                            </DoubleAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </VisualState>
                                                    <VisualState Name="Disabled" />
                                                </VisualStateGroup>
                                            </VisualStateManager.VisualStateGroups>

                                            <Grid Height="18" Width="19" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" Background="#11FFFFFF" FlowDirection="LeftToRight">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="20*"/>
                                                    <ColumnDefinition Width="20*"/>
                                                    <ColumnDefinition Width="20*"/>
                                                    <ColumnDefinition Width="20*"/>
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="23*"/>
                                                    <RowDefinition Height="19*"/>
                                                    <RowDefinition Height="19*"/>
                                                    <RowDefinition Height="19*"/>
                                                </Grid.RowDefinitions>
                                                <Border x:Name="Highlight" Margin="-1" Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1" BorderBrush="{StaticResource Button.Pressed.Border}" Opacity="0" />
                                                <Border x:Name="Background" Margin="0,-1,0,0" Grid.ColumnSpan="4" Grid.Row="1" Grid.RowSpan="3" BorderThickness="1" BorderBrush="{StaticResource Button.Static.Border}" Opacity="1" Background="{StaticResource Button.Static.Background}"/>
                                                <Rectangle Grid.ColumnSpan="4" Grid.RowSpan="1" StrokeThickness="1" Stroke="#FF9F9F9F" Fill="#FFAFCFEA" />
                                                <Path HorizontalAlignment="Center" Margin="4,3,4,3" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Grid.Column="0" Grid.Row="1" Fill="#FF2F2F2F" Stretch="Fill" Data="M11.426758,8.4305077 L11.749023,8.4305077 L11.749023,16.331387 L10.674805,16.331387 L10.674805,10.299648 L9.0742188,11.298672 L9.0742188,10.294277 C9.4788408,10.090176 9.9094238,9.8090878 10.365967,9.4510155 C10.82251,9.0929432 11.176106,8.7527733 11.426758,8.4305077 z M14.65086,8.4305077 L18.566387,8.4305077 L18.566387,9.3435936 L15.671368,9.3435936 L15.671368,11.255703 C15.936341,11.058764 16.27293,10.960293 16.681133,10.960293 C17.411602,10.960293 17.969301,11.178717 18.354229,11.615566 C18.739157,12.052416 18.931622,12.673672 18.931622,13.479336 C18.931622,15.452317 18.052553,16.438808 16.294415,16.438808 C15.560365,16.438808 14.951641,16.234707 14.468243,15.826504 L14.881817,14.929531 C15.368796,15.326992 15.837872,15.525723 16.289043,15.525723 C17.298809,15.525723 17.803692,14.895514 17.803692,13.635098 C17.803692,12.460618 17.305971,11.873379 16.310528,11.873379 C15.83071,11.873379 15.399232,12.079271 15.016094,12.491055 L14.65086,12.238613 z" Grid.ColumnSpan="4" Grid.RowSpan="3"/>
                                                <Ellipse HorizontalAlignment="Center" VerticalAlignment="Center" Fill="#FFFFFFFF" StrokeThickness="0" Grid.ColumnSpan="4" Width="3" Height="3"/>
                                                <Border x:Name="DisabledVisual" Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="4" BorderThickness="1" BorderBrush="#B2FFFFFF" Opacity="0" />
                                            </Grid>
                                        </Grid>
                                    </ControlTemplate>
                                </Grid.Resources>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Button x:Name="PART_Button" Grid.Row="0" Grid.Column="1"
                                        Template="{StaticResource DropDownButtonTemplate}"
                                        Foreground="{TemplateBinding Foreground}" 
                                        Width="20"
                                        Margin="3,0,3,0" 
                                        Focusable="False" 
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Left" />
                                <DatePickerTextBox x:Name="PART_TextBox" 
                                    Grid.Row="0" Grid.Column="0" 
                                    HorizontalContentAlignment="Stretch"
                                    VerticalContentAlignment="Stretch"
                                    Focusable="{TemplateBinding Focusable}" />
                                <Grid x:Name="PART_DisabledVisual" 
                                      Opacity="0" 
                                      IsHitTestVisible="False" 
                                      Grid.Row="0" Grid.Column="0"
                                      Grid.ColumnSpan="2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Rectangle Grid.Row="0" Grid.Column="0" RadiusX="1" RadiusY="1" Fill="#A5FFFFFF"/>
                                    <Rectangle Grid.Row="0" Grid.Column="1" RadiusX="1" RadiusY="1" Fill="#A5FFFFFF" Height="18" Width="19" Margin="3,0,3,0" />
                                    <Popup x:Name="PART_Popup" 
                                           PlacementTarget="{Binding ElementName=PART_TextBox}"
                                           Placement="Bottom" 
                                           StaysOpen="False"
                                           AllowsTransparency="True" />
                                </Grid>
                            </Grid>
                        </Border.Child>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="false">
                            <Setter TargetName="PART_TextBox" Property="Foreground" Value="{Binding Path=Foreground,RelativeSource={RelativeSource TemplatedParent}}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type DatePickerTextBox}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DatePickerTextBox">
                    <Grid>
                        <Grid.Resources>
                            <SolidColorBrush x:Key="WatermarkBrush" Color="#FFAAAAAA"/>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                    <VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Normal" />
                                <VisualState Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
                                        <ColorAnimation Storyboard.TargetName="watermark_decorator" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#FF99C1E2" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="WatermarkStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unwatermarked" />
                                <VisualState Name="Watermarked">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="PART_Watermark" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup Name="FocusStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0" />
                                </VisualStateGroup.Transitions>
                                <VisualState Name="Unfocused" />
                                <VisualState Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>


                        <Border x:Name="Border" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Padding="{TemplateBinding Padding}"
                                Opacity="1">
                            <Grid x:Name="WatermarkContent"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <Border x:Name="ContentElement" BorderThickness="1">
                                    <Border.BorderBrush>
                                        <SolidColorBrush Color="#FFFFFFFF"/>
                                    </Border.BorderBrush>
                                </Border>
                                <Border x:Name="watermark_decorator" BorderThickness="1">
                                    <Border.BorderBrush>
                                        <SolidColorBrush Color="#FFFFFFFF"/>
                                    </Border.BorderBrush>
                                    <ContentControl x:Name="PART_Watermark"
                                                        Opacity="0"
                                                        Focusable="False"
                                                        IsHitTestVisible="False"
                                                        Padding="2"/>
                                </Border>
                                <ScrollViewer x:Name="PART_ContentHost" 
                                              Margin="0"
                                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                                <Border x:Name="FocusVisual" BorderBrush="#FF45D6FA" Opacity="0" IsHitTestVisible="False"/>
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>    
    <ControlTemplate x:Key="FrameNavChromeTemplateKey"
                     TargetType="{x:Type Frame}">
        <Border Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Padding="{TemplateBinding Padding}">
            <DockPanel>
                <Grid Background="{StaticResource NavigationWindowNavigationChromeBackground}"
                      DockPanel.Dock="Top"
                      Height="22">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="16"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Menu Name="NavMenu"
                          Grid.ColumnSpan="3"
                          Height="16"
                          Margin="1,0,0,0"
                          VerticalAlignment="Center" 
                          Style="{StaticResource NavigationWindowMenu}">

                        <MenuItem Padding="0,2,4,0"
                                  Style="{StaticResource NavigationWindowMenuItem}"
                                  ItemContainerStyle="{StaticResource NavigationWindowNavigationButtonJournalEntryStyle}"
                                  IsSubmenuOpen="{Binding Path=(MenuItem.IsSubmenuOpen),Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}">
                            <MenuItem.ItemsSource>
                                <MultiBinding Converter="{StaticResource JournalEntryUnifiedViewConverter}">
                                    <MultiBinding.Bindings>
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" 
                                                 Path="BackStack" />
                                        <Binding RelativeSource="{RelativeSource TemplatedParent}" 
                                                 Path="ForwardStack" />
                                    </MultiBinding.Bindings>
                                </MultiBinding>
                            </MenuItem.ItemsSource>
                        </MenuItem>
                    </Menu>

                    <Path Grid.Column="0" 
                          SnapsToDevicePixels="false"
                          IsHitTestVisible="false"
                          Margin="2,0,0,0"
                          Grid.ColumnSpan="3"
                          StrokeThickness="1" 
                          HorizontalAlignment="Left" 
                          VerticalAlignment="Center" 
                          Data="M22.5767,21.035 Q27,19.37 31.424,21.035 A12.5,12.5,0,0,0,53.5,13 A12.5,12.5,0,0,0,37.765,0.926 Q27,4.93 16.235,0.926 A12.5,12.5,0,0,0,0.5,13 A12.5,12.5,0,0,0,22.5767,21.035 z">
                        <Path.Fill>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStopCollection>
                                        <GradientStop Color="#A0C2CCE7" Offset="0"/>
                                        <GradientStop Color="#60FFFFFF" Offset="1"/>
                                    </GradientStopCollection>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Path.Fill>

                        <Path.Stroke>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStopCollection>
                                        <GradientStop Color="#FFB7C2E3" Offset="0.2"/>
                                        <GradientStop Color="#A0FFFFFF" Offset="0.9"/>
                                    </GradientStopCollection>
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Path.Stroke>
                        <Path.LayoutTransform>
                            <ScaleTransform ScaleX="0.667" ScaleY="0.667"/>
                        </Path.LayoutTransform>
                    </Path>

                    <Button Style="{StaticResource NavigationWindowBackButtonStyle}"
                            Margin="3,0,1,0" 
                            Grid.Column="0">
                        <Button.LayoutTransform>
                            <ScaleTransform ScaleX="0.667" ScaleY="0.667"/>
                        </Button.LayoutTransform>
                    </Button>
                    

                    <Button Style="{StaticResource NavigationWindowForwardButtonStyle}"
                            Margin="1,0,0,0" 
                            Grid.Column="1">
                        <Button.LayoutTransform>
                            <ScaleTransform ScaleX="0.667" ScaleY="0.667"/>
                        </Button.LayoutTransform>
                    </Button>
                </Grid>
                <ContentPresenter x:Name="PART_FrameCP"/>
            </DockPanel>
        </Border>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="CanGoForward"
                               Value="false"/>
                    <Condition Property="CanGoBack"
                               Value="false"/>
                </MultiTrigger.Conditions>
                <Setter TargetName="NavMenu"
                        Property="IsEnabled"
                        Value="false"/>
            </MultiTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type Frame}"
           TargetType="{x:Type Frame}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Frame}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}">
                        <ContentPresenter x:Name="PART_FrameCP"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="NavigationUIVisibility"
                     Value="Visible">
                <Setter Property="Template"
                        Value="{StaticResource FrameNavChromeTemplateKey}"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="JournalOwnership"
                               Value="OwnsJournal"/>
                    <Condition Property="NavigationUIVisibility"
                               Value="Automatic"/>
                </MultiTrigger.Conditions>
                <Setter Property="Template"
                        Value="{StaticResource FrameNavChromeTemplateKey}"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
        <Setter Property="Background" Value="{StaticResource OptionMark.Static.Background}" />
        <Setter Property="BorderBrush" Value="{StaticResource OptionMark.Static.Border}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <Grid x:Name="templateRoot" SnapsToDevicePixels="True" Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border x:Name="radioButtonBorder" 
                            Margin="1,1,2,1" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            CornerRadius="100">
                            <Grid x:Name="markGrid" Margin="2">
                                <Ellipse x:Name="optionMark" Opacity="0" MinWidth="6" MinHeight="6" Fill="{TemplateBinding TextElement.Foreground}"/>
                            </Grid>
                        </Border>
                        <ContentPresenter x:Name="contentPresenter" 
                            RecognizesAccessKey="True" 
                            Grid.Column="1" 
                            Margin="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
                            Focusable="False"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasContent" Value="true">
                            <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
                            <Setter Property="Padding" Value="4,-1,0,0"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{StaticResource OptionMark.MouseOver.Background}" TargetName="radioButtonBorder" />
                            <Setter Property="BorderBrush" Value="{StaticResource OptionMark.MouseOver.Border}" TargetName="radioButtonBorder" />
                            <Setter Property="Fill" Value="{StaticResource OptionMark.MouseOver.Glyph}" TargetName="optionMark" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.56" TargetName="templateRoot" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Opacity" Value="1" TargetName="optionMark" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter Property="Opacity" Value="0.56" TargetName="optionMark" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <SolidColorBrush x:Key="ToolBarDarkFill"
                     Color="#99CCFF"/>
    <SolidColorBrush x:Key="ToolBarDisabledFill"
                     Color="#F7F7F7"/>
    <SolidColorBrush x:Key="ToolBarDisabledBorder"
                     Color="#B5B2B5"/>
    <SolidColorBrush x:Key="ToolBarSeparatorFill"
                     Color="#C6C7C6"/>
    <SolidColorBrush x:Key="ToolBarButtonHover"
                     Color="#BEE6FD"/>
    <SolidColorBrush x:Key="ToolBarButtonHoverBorder"
                     Color="#3C7FB1"/>
    <SolidColorBrush x:Key="ToolBarButtonChecked"
                     Color="#C4E5F6"/>
    <SolidColorBrush x:Key="ToolBarButtonPressed"
                     Color="#C4E5F6"/>
    <SolidColorBrush x:Key="ToolBarButtonPressedBorder"
                     Color="#2C628B"/>
    <SolidColorBrush x:Key="ToolBarMenuBorder"
                     Color="#808080"/>
    <SolidColorBrush x:Key="ToolBarSubMenuBackground"
                     Color="#FDFDFD"/>
    <SolidColorBrush x:Key="ToolBarMenuCheckFill"
                     Color="#E6F0FA"/>
    <SolidColorBrush x:Key="ToolBarOpenHeaderBackground"
                     Color="#FFFBFF"/>
    <SolidColorBrush x:Key="ToolBarTrayBackground"
                     Color="#FDFDFD"/>
    <SolidColorBrush x:Key="ToolBarHorizontalBackground"
                     Color="#FFFBFF"/>
    <SolidColorBrush x:Key="ToolBarVerticalBackground"
                     Color="#FFFBFF"/>
    <SolidColorBrush x:Key="ToolBarGripper"
                     Color="#C6C3C6"/>
    <SolidColorBrush x:Key="ToolBarToggleButtonHorizontalBackground"
                     Color="#DDDDDD"/>
    <SolidColorBrush x:Key="ToolBarToggleButtonVerticalBackground"
                     Color="#DDDDDD"/>



    <Geometry x:Key="ToolBarCheckmark"> M 0,2.5 L 2.5,5 L 7,0.5</Geometry>

    <Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
                <Setter Property="CornerRadius" Value="0,0,0,0" />
            </DataTrigger>
        </Style.Triggers>
        <Setter Property="Margin" Value="0,0,11,0" />
        <Setter Property="CornerRadius" Value="3,3,3,3" />
    </Style>

    <Style x:Key="{x:Static ToolBar.SeparatorStyleKey}"
           TargetType="{x:Type Separator}">
        <Setter Property="Background"
                Value="{StaticResource ToolBarSeparatorFill}"/>
        <Setter Property="MinWidth"
                Value="1"/>
        <Setter Property="MinHeight"
                Value="1"/>
        <Setter Property="Margin"
                Value="2,2,2,2"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            SnapsToDevicePixels="true"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Static ToolBar.ButtonStyleKey}"
           TargetType="{x:Type Button}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Padding"
                Value="2"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="BorderBrush"
                Value="Transparent"/>
        <Setter Property="HorizontalAlignment"
                Value="Center"/>
        <Setter Property="VerticalAlignment"
                Value="Center"/>
        <Setter Property="HorizontalContentAlignment"
                Value="Center"/>
        <Setter Property="VerticalContentAlignment"
                Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Name="Bd"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonPressed}"/>
                        </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="{x:Static ToolBar.ToggleButtonStyleKey}"
           TargetType="{x:Type ToggleButton}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Padding"
                Value="2"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="BorderBrush"
                Value="Transparent"/>
        <Setter Property="HorizontalAlignment"
                Value="Center"/>
        <Setter Property="VerticalAlignment"
                Value="Center"/>
        <Setter Property="HorizontalContentAlignment"
                Value="Center"/>
        <Setter Property="VerticalContentAlignment"
                Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonChecked}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="true"/>
                                <Condition Property="IsChecked"
                                           Value="true"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonPressed}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused"
                                           Value="true"/>
                                <Condition Property="IsChecked"
                                           Value="true"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonPressed}"/>
                        </MultiTrigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                            <Setter Property="Background"
                                    Value="{StaticResource ToolBarButtonPressed}"/>
                        </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="{x:Static ToolBar.CheckBoxStyleKey}"
           BasedOn="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
           TargetType="{x:Type CheckBox}"/>
    <Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}"
           BasedOn="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"
           TargetType="{x:Type RadioButton}"/>


    <Style x:Key="ToolBarComboBoxTransparentButtonStyle"
           TargetType="{x:Type ToggleButton}">
        <Setter Property="MinWidth"
                Value="0"/>
        <Setter Property="MinHeight"
                Value="0"/>
        <Setter Property="Width"
                Value="Auto"/>
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="Focusable"
                Value="false"/>
        <Setter Property="ClickMode"
                Value="Press"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid Background="Transparent">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"
                                              SharedSizeGroup="ComboBoxButton"/>
                        </Grid.ColumnDefinitions>
                        <Border x:Name="Chrome"
                                Grid.Column="1"
                                Width="13"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                SnapsToDevicePixels="true">
                            <Path x:Name="ArrowDownPath"
                                  Data="M 2.5 0 L 8.5 0 L 5.5 3 Z"
                                  Fill="black"
                                  VerticalAlignment="Center"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Chrome"
                                    Property="BorderBrush"
                                    Value="{x:Null}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="true"/>
                                <Condition Property="IsChecked"
                                           Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="Chrome"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </MultiTrigger>
                        <Trigger Property="IsChecked"
                                 Value="true">
                            <Setter TargetName="Chrome"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 Value="true">
                            <Setter TargetName="Chrome"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonPressed}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="ArrowDownPath"
                                    Property="Fill"
                                    Value="{StaticResource ToolBarDisabledBorder}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}"
           TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Margin"
                Value="1,0"/>
        <Setter Property="Padding"
                Value="0"/>
        <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="HorizontalAlignment"
                Value="Center"/>
        <Setter Property="VerticalAlignment"
                Value="Center"/>
        <Setter Property="MinHeight"
                Value="18"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Grid Grid.IsSharedSizeScope="true">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"
                                                  SharedSizeGroup="ComboBoxButton"/>
                            </Grid.ColumnDefinitions>
                            <Border Name="Background"
                                    Background="{TemplateBinding Background}"/>
                            <Border Name="SelectedContentBorder"
                                    Margin="2,2,1,2">
                                <ContentPresenter x:Name="ContentSite"
                                                  Content="{TemplateBinding SelectionBoxItem}"
                                                  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                                  ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                                  Margin="{TemplateBinding Padding}"
                                                  VerticalAlignment="Center"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                            <Border Name="Border"
                                    Grid.ColumnSpan="2"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    BorderBrush="{TemplateBinding BorderBrush}"/>
                            <ToggleButton BorderBrush="white"
                                          BorderThickness="1"
                                          x:Name="DropDownButton"
                                          Grid.ColumnSpan="2"
                                          Style="{StaticResource ToolBarComboBoxTransparentButtonStyle}"
                                          IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"/>
                            <TextBox Padding="{TemplateBinding Padding}"
                                     Margin="1,1,0,1"
                                     MinHeight="18"
                                     x:Name="PART_EditableTextBox"
                                     Style="{StaticResource ComboBoxEditableTextBox}"
                                     Visibility="Collapsed"
                                     IsReadOnly="{Binding Path=IsReadOnly,RelativeSource={RelativeSource TemplatedParent}}"
                                     VerticalAlignment="Center"/>
                        </Grid>
                        <Popup Name="PART_Popup"
                               AllowsTransparency="true"
                               Placement="Bottom"
                               IsOpen="{Binding Path=IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent}}"
                               Focusable="false"
                               PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                            <theme:SystemDropShadowChrome Name="Shdw"
                                                          Color="Transparent"
                                                          MinWidth="{TemplateBinding ActualWidth}"
                                                          MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder"
                                        Background="{TemplateBinding Background}"
                                        BorderThickness="1"
                                        BorderBrush="{StaticResource ToolBarMenuBorder}">
                                    <ScrollViewer Name="DropDownScrollViewer">
                                      <Grid RenderOptions.ClearTypeHint="Enabled">
                                        <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                            <Rectangle
                                                Name="OpaqueRect"
                                                Height="{Binding ElementName=DropDownBorder,Path=ActualHeight}"
                                                Width="{Binding ElementName=DropDownBorder,Path=ActualWidth}"
                                                Fill="{Binding ElementName=DropDownBorder,Path=Background}" />
                                        </Canvas>
                                        <ItemsPresenter Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                      </Grid>
                                    </ScrollViewer>
                                </Border>
                            </theme:SystemDropShadowChrome>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter TargetName="Background"
                                    Property="Background"
                                    Value="{StaticResource ToolBarDisabledFill}"/>
                            <Setter TargetName="Background"
                                    Property="Grid.ColumnSpan"
                                    Value="2"/>
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarDisabledBorder}"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocusWithin"
                                           Value="true"/>
                                <Condition Property="IsDropDownOpen"
                                           Value="false"/>
                                <Condition Property="IsEditable"
                                           Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="SelectedContentBorder"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                        </MultiTrigger>
                        <Trigger Property="IsEditable"
                                 Value="true">
                            <Setter TargetName="DropDownButton"
                                    Property="Background"
                                    Value="{x:Null}"/>
                            <Setter TargetName="ContentSite"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                            <Setter TargetName="PART_EditableTextBox"
                                    Property="Visibility"
                                    Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter TargetName="DropDownButton"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter TargetName="DropDownButton"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocusWithin"
                                 Value="true">
                            <Setter TargetName="DropDownButton"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                            <Setter TargetName="DropDownButton"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                        </Trigger>
                        <Trigger SourceName="PART_Popup"
                                 Property="Popup.HasDropShadow"
                                 Value="true">
                            <Setter TargetName="Shdw"
                                    Property="Margin"
                                    Value="0,0,5,5"/>
                            <Setter TargetName="Shdw"
                                    Property="SnapsToDevicePixels"
                                    Value="true"/>
                            <Setter TargetName="Shdw"
                                    Property="Color"
                                    Value="#71000000"/>
                        </Trigger>
                        <Trigger Property="HasItems"
                                 Value="false">
                            <Setter TargetName="DropDownBorder"
                                    Property="MinHeight"
                                    Value="95"/>
                        </Trigger>
                        <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsGrouping" Value="true" />
                            <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
                        </MultiTrigger.Conditions>
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocusWithin"
                                           Value="true"/>
                                <Condition Property="IsDropDownOpen"
                                           Value="false"/>
                                <Condition Property="IsEditable"
                                           Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                        </MultiTrigger>
                        <Trigger Property="IsEditable"
                                 Value="true">
                            <Setter Property="Padding"
                                    Value="2"/>
                            <Setter Property="IsTabStop"
                                    Value="false"/>
                        </Trigger>
                        <Trigger SourceName="DropDownScrollViewer"
                                 Property="ScrollViewer.CanContentScroll"
                                 Value="false" >
                            <Setter TargetName="OpaqueRect"
                                    Property="Canvas.Top"
                                    Value="{Binding ElementName=DropDownScrollViewer, Path=VerticalOffset}" />
                            <Setter TargetName="OpaqueRect"
                                    Property="Canvas.Left"
                                    Value="{Binding ElementName=DropDownScrollViewer, Path=HorizontalOffset}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Static ToolBar.TextBoxStyleKey}"
           TargetType="{x:Type TextBox}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Margin"
                Value="1,0"/>
        <Setter Property="Padding"
                Value="2"/>
        <Setter Property="HorizontalAlignment"
                Value="Center"/>
        <Setter Property="VerticalAlignment"
                Value="Center"/>
        <Setter Property="MinHeight"
                Value="18"/>
        <Setter Property="ScrollViewer.PanningMode"
                Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <Border Name="Border"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            SnapsToDevicePixels="true">
                        <ScrollViewer x:Name="PART_ContentHost"
                                      VerticalAlignment="Center"
                                      MinHeight="18"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter TargetName="Border"
                                    Property="Background"
                                    Value="{StaticResource ToolBarDisabledFill}"/>
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarDisabledBorder}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocusWithin"
                                 Value="true">
                            <Setter TargetName="Border"
                                    Property="BorderBrush"
                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Static ToolBar.MenuStyleKey}"
           TargetType="{x:Type Menu}">
        <Setter Property="FontFamily"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
        <Setter Property="FontSize"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
        <Setter Property="FontStyle"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
        <Setter Property="FontWeight"
                Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
        <Setter Property="VerticalContentAlignment"
                Value="Center"/>
        <Setter Property="KeyboardNavigation.TabNavigation"
                Value="Continue"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Resources>
            <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
                <Setter Property="OverridesDefaultStyle"
                        Value="true" />
                <Setter Property="Background"
                        Value="{StaticResource ToolBarSeparatorFill}" />
                <Setter Property="Height" Value="1" />
                <Setter Property="Margin" Value="0,1,0,0" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Separator}">
                            <Grid SnapsToDevicePixels="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="24" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Border Grid.Column="1" Margin="8,0,0,0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="{x:Type MenuItem}"
                   TargetType="{x:Type MenuItem}">
                <Setter Property="OverridesDefaultStyle"
                        Value="true" />
                <Setter Property="HorizontalContentAlignment"
                        Value="{Binding Path=HorizontalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="VerticalContentAlignment"
                        Value="{Binding Path=VerticalContentAlignment,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="Background"
                        Value="Transparent"/>
                <Setter Property="Foreground"
                        Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
                <Setter Property="BorderThickness"
                        Value="1"/>
                <Setter Property="Margin"
                        Value="0,1,0,0"/>
                <Setter Property="Padding"
                        Value="8,3,8,3"/>
                <Setter Property="DockPanel.Dock"
                        Value="Top"/>
                <Setter Property="ScrollViewer.PanningMode"
                        Value="Both"/>
                <Setter Property="Stylus.IsFlicksEnabled"
                        Value="False"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Grid Background="Transparent"
                                  SnapsToDevicePixels="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="24"
                                                      Width="Auto"
                                                      SharedSizeGroup="MenuItemIconColumnGroup"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="MenuItemIGTColumnGroup"/>
                                    <ColumnDefinition Width="14"/>
                                </Grid.ColumnDefinitions>
                                <Border Name="Border"
                                        Background="{TemplateBinding Background}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        Grid.ColumnSpan="4"
                                        Margin="1,0"/>
                                <ContentPresenter x:Name="Icon"
                                                  Margin="0"
                                                  VerticalAlignment="Center"
                                                  ContentSource="Icon"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                <Border Name="GlyphPanel"
                                        Margin="0,1"
                                        Width="20"
                                        Height="20"
                                        Visibility="Hidden"
                                        BorderBrush="{StaticResource ToolBarButtonHoverBorder}"
                                        Background="{StaticResource ToolBarMenuCheckFill}"
                                        BorderThickness="1">
                                    <Path VerticalAlignment="Center"
                                          HorizontalAlignment="Center"
                                          FlowDirection="LeftToRight"
                                          Stroke="{TemplateBinding Foreground}"
                                          StrokeThickness="1.2"
                                          Data="{StaticResource ToolBarCheckmark}"/>
                                </Border>

                                <ContentPresenter Grid.Column="1"
                                                  ContentSource="Header"
                                                  Margin="{TemplateBinding Padding}"
                                                  RecognizesAccessKey="True"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                <TextBlock Grid.Column="2"
                                           Text="{TemplateBinding InputGestureText}"
                                           Margin="4,3,2,3"
                                           HorizontalAlignment="Right"/>
                            </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="Border"
                                            Property="BorderBrush"
                                            Value="{StaticResource ToolBarButtonHoverBorder}"/>
                                    <Setter TargetName="Border"
                                            Property="Background"
                                            Value="{StaticResource ToolBarButtonHover}"/>
                                    <Setter TargetName="GlyphPanel"
                                            Property="BorderBrush"
                                            Value="{StaticResource ToolBarButtonPressedBorder}"/>
                                    <Setter TargetName="GlyphPanel"
                                            Property="Background"
                                            Value="{StaticResource ToolBarDarkFill}"/>
                                </Trigger>
                                <Trigger Property="IsEnabled"
                                         Value="false">
                                    <Setter Property="Foreground"
                                            Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="Role"
                             Value="TopLevelHeader">
                        <Setter Property="Padding"
                                Value="6,2,7,2"/>
                        <Setter Property="Grid.IsSharedSizeScope"
                                Value="true"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type MenuItem}">
                                    <Border Name="Border"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1"
                                            SnapsToDevicePixels="true">
                                        <DockPanel Name="Header">
                                            <ContentPresenter x:Name="Icon"
                                                              Margin="4,0,6,0"
                                                              VerticalAlignment="Center"
                                                              ContentSource="Icon"
                                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                            <Path x:Name="GlyphPanel"
                                                  Margin="4,0,6,0"
                                                  Visibility="Collapsed"
                                                  VerticalAlignment="Center"
                                                  FlowDirection="LeftToRight"
                                                  Stroke="{TemplateBinding Foreground}"
                                                  StrokeThickness="1.2"
                                                  Data="{StaticResource ToolBarCheckmark}"/>
                                            <ContentPresenter ContentSource="Header"
                                                              Margin="{TemplateBinding Padding}"
                                                              RecognizesAccessKey="True"
                                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                            <Popup x:Name="PART_Popup"
                                                   Placement="Bottom"
                                                   HorizontalOffset="-1"
                                                   IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
                                                   Focusable="false"
                                                   PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                                                   AllowsTransparency="true">
                                                <theme:SystemDropShadowChrome Name="Shdw"
                                                                              Color="Transparent">
                                                    <Border Name="SubMenuBorder" Background="{StaticResource ToolBarSubMenuBackground}"
                                                            BorderBrush="{StaticResource ToolBarMenuBorder}"
                                                            BorderThickness="1">
                                                        <Grid>
                                                            <Rectangle Fill="{StaticResource ToolBarSubMenuBackground}"
                                                                       Margin="0,-1,0,0"
                                                                       VerticalAlignment="Top"
                                                                       HorizontalAlignment="Left"
                                                                       Height="1"
                                                                       Width="{Binding ElementName=Header, Path=ActualWidth}" />
                                                            <ScrollViewer Name="SubMenuScrollViewer"
                                                                          Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                                              <Grid RenderOptions.ClearTypeHint="Enabled" Grid.IsSharedSizeScope="true">
                                                                  <Grid.ColumnDefinitions>
                                                                      <ColumnDefinition MinWidth="24"
                                                                                        Width="Auto"
                                                                                        SharedSizeGroup="MenuItemIconColumnGroup"/>
                                                                      <ColumnDefinition Width="*"/>
                                                                  </Grid.ColumnDefinitions>
                                                                <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                                                    <Rectangle
                                                                        Name="OpaqueRect"
                                                                        Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}"
                                                                        Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}"
                                                                        Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                                                </Canvas>
                                                                <Rectangle Fill="{StaticResource ToolBarVerticalBackground}"
                                                                           Margin="0,1"/>
                                                                <ItemsPresenter Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle"
                                                                                Grid.ColumnSpan="2"
                                                                                KeyboardNavigation.TabNavigation="Cycle"
                                                                                Margin="0,0,0,1"
                                                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                              </Grid>
                                                            </ScrollViewer>
                                                        </Grid>
                                                    </Border>
                                                </theme:SystemDropShadowChrome>
                                            </Popup>
                                        </DockPanel>
                                    </Border>
                                    <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 Property="IsHighlighted"
                                                 Value="true">
                                            <Setter TargetName="Border"
                                                    Property="BorderBrush"
                                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                                            <Setter TargetName="Border"
                                                    Property="Background"
                                                    Value="{StaticResource ToolBarButtonHover}"/>
                                        </Trigger>
                                        <Trigger Property="IsSubmenuOpen"
                                                 Value="true">
                                            <Setter TargetName="Border"
                                                    Property="BorderBrush"
                                                    Value="{StaticResource ToolBarMenuBorder}"/>
                                            <Setter TargetName="Border"
                                                    Property="Background"
                                                    Value="{StaticResource ToolBarOpenHeaderBackground}"/>
                                        </Trigger>
                                        <Trigger SourceName="PART_Popup"
                                                  Property="Popup.HasDropShadow"
                                                  Value="true">
                                             <Setter TargetName="Shdw"
                                                     Property="Margin"
                                                     Value="0,0,5,5"/>
                                             <Setter TargetName="Shdw"
                                                     Property="SnapsToDevicePixels"
                                                     Value="true"/>
                                             <Setter TargetName="Shdw"
                                                     Property="Color"
                                                     Value="#71000000"/>
                                         </Trigger>
                                        <Trigger Property="IsEnabled"
                                                 Value="false">
                                            <Setter Property="Foreground"
                                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                        <Trigger SourceName="SubMenuScrollViewer"
                                                 Property="ScrollViewer.CanContentScroll"
                                                 Value="false" >
                                            <Setter TargetName="OpaqueRect"
                                                    Property="Canvas.Top"
                                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                                            <Setter TargetName="OpaqueRect"
                                                    Property="Canvas.Left"
                                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="Role"
                             Value="TopLevelItem">
                        <Setter Property="Margin"
                                Value="0,1,0,1"/>
                        <Setter Property="Padding"
                                Value="7,1,8,2"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type MenuItem}">
                                    <Border Name="Border"
                                            Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="1"
                                            SnapsToDevicePixels="true">
                                        <DockPanel>
                                            <ContentPresenter x:Name="Icon"
                                                              Margin="4,0,6,0"
                                                              VerticalAlignment="Center"
                                                              ContentSource="Icon"
                                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                            <Path x:Name="GlyphPanel"
                                                  Margin="4,0,6,0"
                                                  Visibility="Collapsed"
                                                  VerticalAlignment="Center"
                                                  FlowDirection="LeftToRight"
                                                  Stroke="{TemplateBinding Foreground}"
                                                  StrokeThickness="1.2"
                                                  Data="{StaticResource ToolBarCheckmark}"/>
                                            <ContentPresenter ContentSource="Header"
                                                              Margin="{TemplateBinding Padding}"
                                                              RecognizesAccessKey="True"
                                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        </DockPanel>
                                    </Border>
                                    <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="Border"
                                                    Property="BorderBrush"
                                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                                            <Setter TargetName="Border"
                                                    Property="Background"
                                                    Value="{StaticResource ToolBarButtonHover}"/>
                                        </Trigger>
                                        <Trigger Property="IsEnabled"
                                                 Value="false">
                                            <Setter Property="Foreground"
                                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                    <Trigger Property="Role"
                             Value="SubmenuHeader">
                        <Setter Property="DockPanel.Dock"
                                Value="Top"/>
                        <Setter Property="Padding"
                                Value="8,3,8,3"/>
                        <Setter Property="Grid.IsSharedSizeScope"
                                Value="true"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type MenuItem}">
                                    <Grid Background="Transparent"
                                          SnapsToDevicePixels="true">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition MinWidth="24"
                                                              Width="Auto"
                                                              SharedSizeGroup="MenuItemIconColumnGroup"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"
                                                              SharedSizeGroup="MenuItemIGTColumnGroup"/>
                                            <ColumnDefinition Width="14"/>
                                        </Grid.ColumnDefinitions>
                                        <Border Name="Border"
                                                Background="{TemplateBinding Background}"
                                                BorderThickness="{TemplateBinding BorderThickness}"
                                                BorderBrush="{TemplateBinding BorderBrush}"
                                                Grid.ColumnSpan="4"
                                                Margin="1,0"/>
                                        <ContentPresenter x:Name="Icon"
                                                          Margin="3"
                                                          VerticalAlignment="Center"
                                                          ContentSource="Icon"
                                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        <Border Name="GlyphPanel"
                                                Margin="0,1"
                                                Width="20"
                                                Height="20"
                                                Visibility="Hidden"
                                                BorderBrush="{StaticResource ToolBarButtonHoverBorder}"
                                                Background="{StaticResource ToolBarMenuCheckFill}"
                                                BorderThickness="1">
                                            <Path VerticalAlignment="Center"
                                                  HorizontalAlignment="Center"
                                                  FlowDirection="LeftToRight"
                                                  Stroke="{TemplateBinding Foreground}"
                                                  StrokeThickness="1.2"
                                                  Data="{StaticResource ToolBarCheckmark}"/>
                                        </Border>
                                        <ContentPresenter Grid.Column="1"
                                                          ContentSource="Header"
                                                          Margin="{TemplateBinding Padding}"
                                                          RecognizesAccessKey="True"
                                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                        <Path Grid.Column="3"
                                              DockPanel.Dock="Right"
                                              VerticalAlignment="Center"
                                              Margin="4,0,6,0"
                                              Fill="{TemplateBinding Foreground}"
                                              Data="{StaticResource RightArrow}"/>
                                        <Popup x:Name="PART_Popup"
                                               Placement="Right"
                                               IsOpen="{Binding Path=IsSubmenuOpen,RelativeSource={RelativeSource TemplatedParent}}"
                                               Focusable="false"
                                               PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
                                               AllowsTransparency="true">
                                            <theme:SystemDropShadowChrome Name="Shdw"
                                                                          Color="Transparent">
                                                <Border Name="SubMenuBorder" Background="{StaticResource ToolBarSubMenuBackground}"
                                                        BorderBrush="{StaticResource ToolBarMenuBorder}"
                                                        BorderThickness="1"
                                                        Grid.IsSharedSizeScope="true">
                                                    <ScrollViewer Name="SubMenuScrollViewer"
                                                                  Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}}">
                                                      <Grid RenderOptions.ClearTypeHint="Enabled">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition MinWidth="24"
                                                                              Width="Auto"
                                                                              SharedSizeGroup="MenuItemIconColumnGroup"/>
                                                            <ColumnDefinition Width="*"/>
                                                        </Grid.ColumnDefinitions>
                                                        <Canvas Height="0" Width="0" HorizontalAlignment="Left" VerticalAlignment="Top">
                                                            <Rectangle
                                                                Name="OpaqueRect"
                                                                Height="{Binding ElementName=SubMenuBorder,Path=ActualHeight}"
                                                                Width="{Binding ElementName=SubMenuBorder,Path=ActualWidth}"
                                                                Fill="{Binding ElementName=SubMenuBorder,Path=Background}" />
                                                        </Canvas>
                                                        <Rectangle Fill="{StaticResource ToolBarVerticalBackground}"
                                                                   Margin="0,1"/>
                                                        <ItemsPresenter Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle"
                                                                        Grid.ColumnSpan="2"
                                                                        KeyboardNavigation.TabNavigation="Cycle"
                                                                        Margin="0,0,0,1"
                                                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                      </Grid>
                                                    </ScrollViewer>
                                                </Border>
                                            </theme:SystemDropShadowChrome>
                                        </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 Property="IsHighlighted"
                                                 Value="true">
                                            <Setter TargetName="Border"
                                                    Property="BorderBrush"
                                                    Value="{StaticResource ToolBarButtonHoverBorder}"/>
                                            <Setter TargetName="Border"
                                                    Property="Background"
                                                    Value="{StaticResource ToolBarButtonHover}"/>
                                            <Setter TargetName="GlyphPanel"
                                                    Property="BorderBrush"
                                                    Value="{StaticResource ToolBarButtonPressedBorder}"/>
                                            <Setter TargetName="GlyphPanel"
                                                    Property="Background"
                                                    Value="{StaticResource ToolBarDarkFill}"/>
                                        </Trigger>
                                        <Trigger SourceName="PART_Popup"
                                                  Property="Popup.HasDropShadow"
                                                  Value="true">
                                             <Setter TargetName="Shdw"
                                                     Property="Margin"
                                                     Value="0,0,5,5"/>
                                             <Setter TargetName="Shdw"
                                                     Property="SnapsToDevicePixels"
                                                     Value="true"/>
                                             <Setter TargetName="Shdw"
                                                     Property="Color"
                                                     Value="#71000000"/>
                                         </Trigger>
                                        <Trigger Property="IsEnabled"
                                                 Value="false">
                                            <Setter Property="Foreground"
                                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                        <Trigger SourceName="SubMenuScrollViewer"
                                                 Property="ScrollViewer.CanContentScroll"
                                                 Value="false" >
                                            <Setter TargetName="OpaqueRect"
                                                    Property="Canvas.Top"
                                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=VerticalOffset}" />
                                            <Setter TargetName="OpaqueRect"
                                                    Property="Canvas.Left"
                                                    Value="{Binding ElementName=SubMenuScrollViewer, Path=HorizontalOffset}" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Style.Resources>
    </Style>



    <Style x:Key="ToolBarThumbStyle"
           TargetType="{x:Type Thumb}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}"
                            Background="Transparent"
                            SnapsToDevicePixels="True">
                        <Rectangle>
                            <Rectangle.Fill>
                                <DrawingBrush Viewbox="0,0,4,4"
                                              Viewport="0,0,4,4"
                                              TileMode="Tile"
                                              ViewportUnits="Absolute"
                                              ViewboxUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Brush="White"
                                                                 Geometry="M 1 1 L 1 3 L 3 3 L 3 1 z"/>
                                                <GeometryDrawing Brush="{StaticResource ToolBarGripper}"
                                                                 Geometry="M 0 0 L 0 2 L 2 2 L 2 0 z"/>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter Property="Cursor"
                                    Value="SizeAll"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ToolBarHorizontalOverflowButtonStyle"
           TargetType="{x:Type ToggleButton}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
            <Setter Property="Background"
                        Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
        </DataTrigger>
    </Style.Triggers>
    <Setter Property="Background"
                Value="{StaticResource ToolBarToggleButtonHorizontalBackground}"/>
        <Setter Property="MinHeight"
                Value="0"/>
        <Setter Property="MinWidth"
                Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Name="Bd"
                            CornerRadius="0,3,3,0"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="true">
                        <Canvas Width="6"
                                Height="7"
                                Margin="7,2,2,2"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom"
                                SnapsToDevicePixels="true">
                            <Path Stroke="White"
                                  Data="M 1 1.5 L 6 1.5"/>
                            <Path Stroke="{TemplateBinding Foreground}"
                                  Data="M 0 0.5 L 5 0.5"/>
                            <Path Fill="White"
                                  Data="M 0.5 4 L 6.5 4 L 3.5 7 Z"/>
                            <Path Fill="{TemplateBinding Foreground}"
                                  Data="M -0.5 3 L 5.5 3 L 2.5 6 Z"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{StaticResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ToolBarVerticalOverflowButtonStyle"
           TargetType="{x:Type ToggleButton}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
            <Setter Property="Background"
                        Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
        </DataTrigger>
    </Style.Triggers>
    <Setter Property="Background"
                Value="{StaticResource ToolBarToggleButtonVerticalBackground}"/>
        <Setter Property="MinHeight"
                Value="0"/>
        <Setter Property="MinWidth"
                Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Name="Bd"
                            CornerRadius="0,0,3,3"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="true">
                        <Canvas Width="7"
                                Height="6"
                                Margin="2,7,2,2"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom"
                                SnapsToDevicePixels="true">
                            <Path Stroke="White"
                                  Data="M 1.5 1 L 1.5 6"/>
                            <Path Stroke="{TemplateBinding Foreground}"
                                  Data="M 0.5 0 L 0.5 5"/>
                            <Path Fill="White"
                                  Data="M 3.5 0.5 L 7 3.5 L 4 6.5 Z"/>
                            <Path Fill="{TemplateBinding Foreground}"
                                  Data="M 3 -0.5 L 6 2.5 L 3 5.5 Z"/>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{StaticResource ToolBarButtonHover}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{StaticResource ToolBarGripper}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type ToolBar}"
           TargetType="{x:Type ToolBar}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
            <Setter Property="Background"
                        Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
        </DataTrigger>
    </Style.Triggers>
    <Setter Property="Background" Value="{StaticResource ToolBarHorizontalBackground}"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ToolBar}">
                <Grid Name="Grid"
                      Margin="3,1,1,1"
                      SnapsToDevicePixels="true">
                    <Grid HorizontalAlignment="Right"
                          x:Name="OverflowGrid">
                        <ToggleButton x:Name="OverflowButton"
                                      FocusVisualStyle="{x:Null}"
                                      IsEnabled="{TemplateBinding HasOverflowItems}"
                                      Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}"
                                      IsChecked="{Binding Path=IsOverflowOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                                      ClickMode="Press"/>
                        <Popup x:Name="OverflowPopup"
                               AllowsTransparency="true"
                               Placement="Bottom"
                               IsOpen="{Binding Path=IsOverflowOpen,RelativeSource={RelativeSource TemplatedParent}}"
                               StaysOpen="false"
                               Focusable="false"
                               PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
                            <theme:SystemDropShadowChrome Name="Shdw"
                                                          Color="Transparent">
                                <Border Background="{StaticResource ToolBarSubMenuBackground}"
                                        BorderBrush="{StaticResource ToolBarMenuBorder}"
                                        BorderThickness="1"
                                        RenderOptions.ClearTypeHint="Enabled"
                                        x:Name="ToolBarSubMenuBorder">
                                    <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel"
                                                          Margin="2"
                                                          WrapWidth="200"
                                                          Focusable="true"
                                                          FocusVisualStyle="{x:Null}"
                                                          KeyboardNavigation.TabNavigation="Cycle"
                                                          KeyboardNavigation.DirectionalNavigation="Cycle"
                                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </Border>
                            </theme:SystemDropShadowChrome>
                        </Popup>
                    </Grid>
                    <Border x:Name="MainPanelBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Padding="{TemplateBinding Padding}"
                            Style="{StaticResource ToolBarMainPanelBorderStyle}">
                        <DockPanel KeyboardNavigation.TabIndex="1"
                                   KeyboardNavigation.TabNavigation="Local">
                            <Thumb x:Name="ToolBarThumb"
                                   Style="{StaticResource ToolBarThumbStyle}"
                                   Margin="-3,-1,0,0"
                                   Width="10"
                                   Padding="6,5,1,6"/>
                            <ContentPresenter x:Name="ToolBarHeader"
                                              ContentSource="Header"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              Margin="4,0,4,0"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            <ToolBarPanel x:Name="PART_ToolBarPanel"
                                          IsItemsHost="true"
                                          Margin="0,1,2,2"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </DockPanel>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsOverflowOpen"
                             Value="true">
                        <Setter TargetName="ToolBarThumb"
                                Property="IsEnabled"
                                Value="false"/>
                    </Trigger>
                    <Trigger Property="Header"
                             Value="{x:Null}">
                        <Setter TargetName="ToolBarHeader"
                                Property="Visibility"
                                Value="Collapsed"/>
                    </Trigger>
                    <Trigger Property="ToolBarTray.IsLocked"
                             Value="true">
                        <Setter TargetName="ToolBarThumb"
                                Property="Visibility"
                                Value="Collapsed"/>
                    </Trigger>
                    <Trigger SourceName="OverflowPopup"
                             Property="Popup.HasDropShadow"
                             Value="true">
                        <Setter TargetName="Shdw"
                                Property="Margin"
                                Value="0,0,5,5"/>
                        <Setter TargetName="Shdw"
                                Property="SnapsToDevicePixels"
                                Value="true"/>
                        <Setter TargetName="Shdw"
                                Property="Color"
                                Value="#71000000"/>
                    </Trigger>
                    <Trigger Property="Orientation"
                             Value="Vertical">
                        <Setter TargetName="Grid"
                                Property="Margin"
                                Value="1,3,1,1"/>
                        <Setter TargetName="OverflowButton"
                                Property="Style"
                                Value="{StaticResource ToolBarVerticalOverflowButtonStyle}"/>
                        <Setter TargetName="ToolBarThumb"
                                Property="Height"
                                Value="10"/>
                        <Setter TargetName="ToolBarThumb"
                                Property="Width"
                                Value="Auto"/>
                        <Setter TargetName="ToolBarThumb"
                                Property="Margin"
                                Value="-1,-3,0,0"/>
                        <Setter TargetName="ToolBarThumb"
                                Property="Padding"
                                Value="5,6,6,1"/>
                        <Setter TargetName="ToolBarHeader"
                                Property="Margin"
                                Value="0,0,0,4"/>
                        <Setter TargetName="PART_ToolBarPanel"
                                Property="Margin"
                                Value="1,0,2,2"/>
                        <Setter TargetName="ToolBarThumb"
                                Property="DockPanel.Dock"
                                Value="Top"/>
                        <Setter TargetName="ToolBarHeader"
                                Property="DockPanel.Dock"
                                Value="Top"/>
                        <Setter TargetName="OverflowGrid"
                                Property="HorizontalAlignment"
                                Value="Stretch"/>
                        <Setter TargetName="OverflowGrid"
                                Property="VerticalAlignment"
                                Value="Bottom"/>
                        <Setter TargetName="OverflowPopup"
                                Property="Placement"
                                Value="Right"/>
                        <Setter TargetName="MainPanelBorder"
                                Property="Margin"
                                Value="0,0,0,11"/>
                        <Setter Property="Background"
                                Value="{StaticResource ToolBarVerticalBackground}"/>
                    </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="{x:Type ToolBarTray}" TargetType="{x:Type ToolBarTray}">
        <Setter Property="Background"
                Value="{StaticResource ToolBarTrayBackground}"/>
    <Style.Triggers>
        <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
            <Setter Property="Background"
                        Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
        </DataTrigger>
    </Style.Triggers>
</Style>

</ResourceDictionary>
