<ResourceDictionary 
    x:Class="___C_File_Editor.Styles"
    x:ClassModifier="public"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="../Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml"/>
  </ResourceDictionary.MergedDictionaries>

  <!-- BRUSHES -->
  <SolidColorBrush x:Key="BackgroundBrush" Color="{StaticResource Color_009}"/>
  <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="{StaticResource Color_024}"/>
  <SolidColorBrush x:Key="DisabledSelectedBackgroundBrush" Color="{StaticResource Color_024B}"/>
  <SolidColorBrush x:Key="ForegroundBrush" Color="{StaticResource Color_002}"/>
  <SolidColorBrush x:Key="DisabledForegroundBrush" Color="{StaticResource Color_003}"/>
  <SolidColorBrush x:Key="SelectedForegroundBrush" Color="{StaticResource Color_025}"/>

  <!-- DataGrid Brushes -->
  <SolidColorBrush x:Key="DataGridBackgroundBrush" Color="{StaticResource Color_009}"/>
  <SolidColorBrush x:Key="DataGridBorderBrush" Color="#FF111111"/>
  <SolidColorBrush x:Key="DataGridGridLinesBrush" Color="#FF383838"/>
  <SolidColorBrush x:Key="DataGridColumnHeaderBackgroundBrush" Color="{StaticResource Color_007}"/>
  <SolidColorBrush x:Key="DataGridColumnHeaderMouseOverBackgroundBrush" Color="{StaticResource Color_006}"/>
  <SolidColorBrush x:Key="DataGridColumnHeaderSeparatorBrush" Color="{StaticResource Color_006}"/>
  <SolidColorBrush x:Key="DataGridCellBackgroundBrush" Color="{StaticResource Color_009}"/>
  <SolidColorBrush x:Key="DataGridFocusedBorderBrush" Color="{StaticResource Color_024}"/>
  <SolidColorBrush x:Key="DataGridUnselectedBackgroundBrush" Color="{StaticResource Color_008}"/>

  <!-- TabControl Brushes -->
  <SolidColorBrush x:Key="TabControlBackgroundBrush" Color="{StaticResource Color_007}"/>
  <SolidColorBrush x:Key="TabControlBorderBrush" Color="{StaticResource Color_006}"/>
  <SolidColorBrush x:Key="TabItemPathBrush" Color="{StaticResource Color_004}"/>
  <SolidColorBrush x:Key="TabControlHoverBrush" Color="{StaticResource Color_009}"/>

  <!--ContextMenu colors.-->
  <SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource Color_009}"/>
  <SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource Color_006}"/>
  <SolidColorBrush x:Key="MenuSeparatorBrush" Color="{StaticResource Color_005}"/>



  <!-- CaptionButton style -->
  <Style x:Key="CaptionButtonStyleKey" TargetType="{x:Type Button}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Foreground" Value="White"/>
    <Setter Property="FontFamily" Value="Marlett"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Margin" Value="2"/>
    <Setter Property="Padding" Value="6,3"/>
    <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Border x:Name="border" Background="Transparent" SnapsToDevicePixels="True">
            <Border.Effect>
              <DropShadowEffect Opacity="0"/>
            </Border.Effect>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
                      <EasingDoubleKeyFrame KeyTime="0" Value="0.6"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="MouseOver">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
                      <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Pressed">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
                      <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.ShadowDepth)" Storyboard.TargetName="border">
                      <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Color)" Storyboard.TargetName="border">
                      <EasingColorKeyFrame KeyTime="0" Value="White"/>
                    </ColorAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)" Storyboard.TargetName="border">
                      <EasingDoubleKeyFrame KeyTime="0" Value="0.6"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Disabled"/>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentPresenter x:Name="contentPresenter" Focusable="False" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
        <Setter Property="Opacity" Value="0.5"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!-- DataGrid style -->
  <Style x:Key="DataGridStyle" TargetType="{x:Type DataGrid}">
    <Setter Property="Padding" Value="0"/>
    <Setter Property="FontSize" Value="12"/>
    <Setter Property="FontFamily" Value="Meiryo"/>
    <Setter Property="Background" Value="{StaticResource DataGridBackgroundBrush}"/>
    <Setter Property="BorderBrush" Value="{StaticResource DataGridBorderBrush}"/>
    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="IsTabStop" Value="True"/>
    <Setter Property="GridLinesVisibility" Value="Horizontal"/>
    <Setter Property="HorizontalGridLinesBrush" Value="{StaticResource DataGridGridLinesBrush}"/>
    <Setter Property="VerticalGridLinesBrush" Value="{StaticResource DataGridGridLinesBrush}"/>
    <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"/>
    <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Standard"/>
    <Setter Property="EnableColumnVirtualization" Value="True"/>
    <Setter Property="EnableRowVirtualization" Value="True"/>
    <Style.Triggers>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="BorderBrush" Value="{StaticResource DataGridFocusedBorderBrush}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  <!--Style and template for the resize control on the DataGridColumnHeader.-->
  <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
    <Setter Property="Width" Value="5"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Cursor" Value="SizeWE"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- DataGridColumnHeader style -->
  <Style x:Key="DataGridColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="MinHeight" Value="24"/>
    <Setter Property="Cursor" Value="Hand"/>
    <!--<EventSetter Event="MouseLeftButtonUp" Handler="DataGridColumnHeader_MouseLeftButtonUp"/>-->
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Border x:Name="BackgroundBorder" BorderThickness="0" 
              Background="{StaticResource DataGridColumnHeaderBackgroundBrush}" 
              BorderBrush="{StaticResource DataGridColumnHeaderBackgroundBrush}" 
              Grid.ColumnSpan="2"/>
            <ContentPresenter x:Name="content" Margin="6,3,6,3" VerticalAlignment="Center"/>
            <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="1" Width="8" Height="6" Fill="White" Margin="0,0,4,0" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.4"/>
            <Rectangle Width="1" Margin="-1,3,0,3" Fill="{StaticResource DataGridColumnHeaderSeparatorBrush}" HorizontalAlignment="Left" Grid.ColumnSpan="2"/>
            <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/>
            <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="CanUserSort" Value="False">
              <Setter Property="Cursor" Value="Arrow"/>
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True"/>
                <Condition Property="CanUserSort" Value="True"/>
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="BackgroundBorder" Value="{StaticResource DataGridColumnHeaderMouseOverBackgroundBrush}"/>
              <Setter Property="BorderBrush" TargetName="BackgroundBorder" Value="{StaticResource DataGridColumnHeaderSeparatorBrush}"/>
            </MultiTrigger>
            <Trigger Property="SortDirection" Value="Ascending">
              <Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
              <Setter TargetName="SortArrow" Property="RenderTransform">
                <Setter.Value>
                  <RotateTransform Angle="180"/>
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="SortDirection" Value="Descending">
              <Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Foreground" Value="#FF666666"/>
            </Trigger>
            <Trigger Property="HorizontalContentAlignment" Value="Center">
              <Setter TargetName="content" Property="HorizontalAlignment" Value="Center"/>
            </Trigger>
            <Trigger Property="DisplayIndex" Value="0">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_LeftHeaderGripper"></Setter>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- DataGridRow style -->
  <Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
    <Style.Resources>
      <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#FFEEEEEE"/>
    </Style.Resources>
    <Setter Property="Background" Value="#FF282828"/>
    <Style.Triggers>
      <Trigger Property="IsSelected" Value="False">
        <Setter Property="Background" Value="{StaticResource DataGridUnselectedBackgroundBrush}"/>
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Background" Value="{StaticResource SelectedBackgroundBrush}"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsSelected" Value="True"/>
          <Condition Property="IsEnabled" Value="False"/>
        </MultiTrigger.Conditions>
        <Setter Property="Background" Value="{StaticResource DisabledSelectedBackgroundBrush}"/>
      </MultiTrigger>
    </Style.Triggers>
  </Style>

  <!-- DataGridCell style -->
  <Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
    <EventSetter Event="PreviewMouseLeftButtonDown" Handler="DataGridCell_PreviewMouseLeftButtonDown"/>
    <EventSetter Event="PreviewKeyDown" Handler="DataGridCell_PreviewKeyDown"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type DataGridCell}">
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CurrentStates">
                <VisualState x:Name="Regular"/>
                <VisualState x:Name="Current">
                  <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid.ColumnDefinitions>
              <ColumnDefinition/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Rectangle Name="FocusVisual" Fill="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0"/>
            <ContentPresenter
              Content="{TemplateBinding Content}"
              ContentTemplate="{TemplateBinding ContentTemplate}"
              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
              Margin="{TemplateBinding Padding}"/>
            <Rectangle Name="RightGridLine" Grid.Column="1" VerticalAlignment="Stretch" Width="1"/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>



  <!-- TabControl style -->
  <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabControl}">
          <Grid KeyboardNavigation.TabNavigation="Local">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                      <EasingColorKeyFrame KeyTime="0" Value="#FF222222"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <TabPanel x:Name="HeaderPanel"
              Grid.Row="0"
              Panel.ZIndex="1"
              Margin="0,0,4,-1"
              IsItemsHost="True"
              KeyboardNavigation.TabIndex="1"
              Background="Transparent"/>
            <Border x:Name="Border"
              Grid.Row="1"
              BorderThickness="1"
              CornerRadius="2"
              KeyboardNavigation.TabNavigation="Local"
              KeyboardNavigation.DirectionalNavigation="Contained"
              KeyboardNavigation.TabIndex="2"
              BorderBrush="{StaticResource TabControlBorderBrush}"
              Background="{StaticResource TabControlBackgroundBrush}">
              <ContentPresenter x:Name="PART_SelectedContentHost"
                Margin="4"
                ContentSource="SelectedContent"/>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" Value="0.5"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- TabItem style -->
  <Style x:Key="TabItemStyle" TargetType="{x:Type TabItem}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabItem}">
          <Grid x:Name="Root">
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="SelectionStates">
                <VisualState x:Name="Unselected"/>
                <VisualState x:Name="Selected">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                      <EasingColorKeyFrame KeyTime="0" Value="{StaticResource Color_006}"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
              <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="MouseOver"/>
                <VisualState x:Name="Disabled">
                  <Storyboard>
                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                      <EasingColorKeyFrame KeyTime="0" Value="#FF222222"/>
                    </ColorAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Border" Margin="0,0,4,1" BorderThickness="1,1,1,0"
              BorderBrush="{StaticResource TabControlBorderBrush}"
              Background="{StaticResource TabControlBackgroundBrush}">
              <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="12,2,12,2" RecognizesAccessKey="True"/>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
              <Setter Property="Panel.ZIndex" Value="100"/>
              <Setter Property="Margin" Value="0,0,0,-1"/>
              <Setter Property="Foreground" Value="#FFCCCCCC"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="False">
              <Setter Property="Foreground" Value="#FF777777"/>
              <Setter Property="Opacity" Value="0.8"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- StatusBar style -->
  <Style x:Key="StatusBarStyle" TargetType="{x:Type StatusBar}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type StatusBar}">
          <Border Padding="3,0">
            <Border.BorderBrush>
              <SolidColorBrush Color="Transparent"/>
            </Border.BorderBrush>
            <Border.Background>
              <SolidColorBrush Color="Transparent"/>
            </Border.Background>
            <ItemsPresenter/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- StatusBarItem style -->
  <Style x:Key="StatusBarItemStyle" TargetType="{x:Type StatusBarItem}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type StatusBarItem}">
          <ContentPresenter Margin="3" Name="ContentSite" VerticalAlignment="Center"/>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- StatusBar Separator style -->
  <Style x:Key="{x:Static StatusBar.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Separator}">
          <Rectangle Width="1" Margin="3">
            <Rectangle.Fill>
              <SolidColorBrush Color="{DynamicResource Color_005}"/>
            </Rectangle.Fill>
          </Rectangle>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- TextBlock style -->
  <Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
    <Setter Property="FontFamily" Value="Meiryo"/>
    <Setter Property="FontSize" Value="12"/>
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
      </Trigger>
    </Style.Triggers>
  </Style>

  
  
  <!-- ContextMenu style -->
  <Style x:Key="ContextMenuStyle" TargetType="{x:Type ContextMenu}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
    <Setter Property="VerticalOffset" Value="-1"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ContextMenu}">
          <Border x:Name="Border" Background="{StaticResource ContextMenuBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource ContextMenuBorderBrush}">
            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- MenuItem Separator Style -->
  <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Height" Value="1"/>
    <Setter Property="Margin" Value="6,4"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
          <Border BorderBrush="{StaticResource MenuSeparatorBrush}" BorderThickness="1"/>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- SubmenuHeader -->
  <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
    <Border Name="Border" >
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
          <ColumnDefinition Width="13"/>
        </Grid.ColumnDefinitions>
        <TextBlock x:Name="HeaderHost" Grid.Column="0" Text="{TemplateBinding Header}" VerticalAlignment="Center" Padding="10,6,10,7"/>
        <TextBlock x:Name="InputGestureText" Grid.Column="1" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center" Padding="10,6,5,7" Opacity="0.6"/>
        <Path x:Name="Arrow" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 0 7 L 4 3.5 Z" Fill="{StaticResource ForegroundBrush}"/>
        <Popup Name="Popup" Placement="Right" HorizontalOffset="0" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
          <Border Name="SubmenuBorder" SnapsToDevicePixels="True" Background="{StaticResource BackgroundBrush}" BorderBrush="{StaticResource ContextMenuBorderBrush}" BorderThickness="1" >
            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
          </Border>
        </Popup>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource SelectedForegroundBrush}"/>
        <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource SelectedForegroundBrush}"/>
      </Trigger>
      <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
        <Setter TargetName="SubmenuBorder" Property="Padding" Value="0"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <!-- SubmenuItem -->
  <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
    <Border Name="Border" >
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
          <ColumnDefinition Width="13"/>
        </Grid.ColumnDefinitions>
        <TextBlock x:Name="HeaderHost" Grid.Column="0" Text="{TemplateBinding Header}" VerticalAlignment="Center" Padding="10,6,10,7"/>
        <TextBlock x:Name="InputGestureText" Grid.Column="1" Text="{TemplateBinding InputGestureText}" VerticalAlignment="Center" Padding="5,6,0,7" Opacity="0.6"/>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsHighlighted" Value="true">
        <Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource SelectedForegroundBrush}"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <!-- MenuItem Style -->
  <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
    <Setter Property="FontFamily" Value="Meiryo"/>
    <Setter Property="FontSize" Value="12"/>
    <Style.Triggers>
      <!--<Trigger Property="Role" Value="TopLevelHeader">
        <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}"/>
        <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
      </Trigger>
      <Trigger Property="Role" Value="TopLevelItem">
        <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelItemTemplateKey}}"/>
      </Trigger>-->
      <Trigger Property="Role" Value="SubmenuHeader">
        <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}"/>
      </Trigger>
      <Trigger Property="Role" Value="SubmenuItem">
        <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuItemTemplateKey}}"/>
      </Trigger>
    </Style.Triggers>
  </Style>



  <Style BasedOn="{StaticResource DataGridStyle}" TargetType="{x:Type DataGrid}"/>
  <Style BasedOn="{StaticResource DataGridColumnHeaderStyle}" TargetType="{x:Type DataGridColumnHeader}"/>
  <Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="{x:Type DataGridRow}"/>
  <Style BasedOn="{StaticResource DataGridCellStyle}" TargetType="{x:Type DataGridCell}"/>
  <Style BasedOn="{StaticResource TabControlStyle}" TargetType="{x:Type TabControl}"/>
  <Style BasedOn="{StaticResource TabItemStyle}" TargetType="{x:Type TabItem}"/>
  <Style BasedOn="{StaticResource StatusBarStyle}" TargetType="{x:Type StatusBar}"/>
  <Style BasedOn="{StaticResource StatusBarItemStyle}" TargetType="{x:Type StatusBarItem}"/>
  <Style BasedOn="{StaticResource {x:Static StatusBar.SeparatorStyleKey}}" TargetType="{x:Type Separator}"/>
  <Style BasedOn="{StaticResource TextBlockStyle}" TargetType="{x:Type TextBlock}"/>
  <Style BasedOn="{StaticResource ContextMenuStyle}" TargetType="{x:Type ContextMenu}"/>
  <Style BasedOn="{StaticResource MenuItemStyle}" TargetType="{x:Type MenuItem}"/>

</ResourceDictionary>