<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:converters="clr-namespace:Fluent.Converters" mc:Ignorable="d" xmlns:FluentHelpers="clr-namespace:Fluent.Helpers" xmlns:styleSelectors="clr-namespace:Fluent.StyleSelectors" xmlns:templateSelectors="clr-namespace:Fluent.TemplateSelectors" xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" xmlns:theming="clr-namespace:Fluent.Theming">
  <ControlTemplate x:Key="ControlFocusEmptyTemplate" TargetType="{x:Type Control}">
    <Rectangle Stroke="Transparent">
      <Rectangle.Fill>
        <SolidColorBrush />
      </Rectangle.Fill>
    </Rectangle>
  </ControlTemplate>
  <converters:ApplicationMenuRightScrollViewerExtractorConverter x:Key="ApplicationMenuRightScrollViewerExtractorConverter" />
  <Storyboard x:Key="Fluent.Ribbon.Storyboards.Backstage.IsOpenTrueStoryboard">
    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)">
      <EasingThicknessKeyFrame KeyTime="0" Value="-125,0,0,0" />
      <EasingThicknessKeyFrame KeyTime="0:0:0.5" Value="0">
        <EasingThicknessKeyFrame.EasingFunction>
          <CubicEase EasingMode="EaseOut" />
        </EasingThicknessKeyFrame.EasingFunction>
      </EasingThicknessKeyFrame>
    </ThicknessAnimationUsingKeyFrames>
  </Storyboard>
  <Storyboard x:Key="Fluent.Ribbon.Storyboards.Backstage.IsOpenFalseStoryboard">
    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)">
      <EasingThicknessKeyFrame KeyTime="0" Value="0" />
      <EasingThicknessKeyFrame KeyTime="0:0:0.3" Value="-125,0,0,0">
        <EasingThicknessKeyFrame.EasingFunction>
          <CubicEase EasingMode="EaseOut" />
        </EasingThicknessKeyFrame.EasingFunction>
      </EasingThicknessKeyFrame>
    </ThicknessAnimationUsingKeyFrames>
  </Storyboard>
  <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
  <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter" />
  <Fluent:ScreenTip x:Key="Fluent.Ribbon.Resources.RibbonTabControl.MinimizeScreenTip" x:Shared="False" Title="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.MinimizeButtonScreenTipTitle, Mode=OneWay}" Text="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.MinimizeButtonScreenTipText, Mode=OneWay}" />
  <Fluent:ScreenTip x:Key="Fluent.Ribbon.Resources.RibbonTabControl.ExpandScreenTip" x:Shared="False" Title="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.ExpandButtonScreenTipTitle, Mode=OneWay}" Text="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.ExpandButtonScreenTipText, Mode=OneWay}" />
  <DataTemplate x:Key="Fluent.Ribbon.Templates.RibbonGroupBox.OneLineHeaderTemplate">
    <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{Binding}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" TextAlignment="Center" />
  </DataTemplate>
  <DataTemplate x:Key="Fluent.Ribbon.Templates.RibbonGroupBox.TwoLineHeaderTemplate">
    <Fluent:TwoLineLabel Text="{Binding}" HorizontalAlignment="Center" VerticalAlignment="Center" HasGlyph="True" />
  </DataTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.RibbonGroupBox.TwoLineHeaderContentControl" TargetType="{x:Type ContentControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ContentControl}">
          <ContentPresenter Fluent:RibbonGroupBox.IsCollapsedHeaderContentPresenter="True" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="TwoLineLabelControlTemplate" TargetType="{x:Type Fluent:TwoLineLabel}">
    <StackPanel x:Name="stackPanel" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
      <AccessText TextWrapping="Wrap" x:Name="PART_TextRun" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
      <StackPanel x:Name="stackPanel1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <AccessText TextWrapping="Wrap" x:Name="PART_TextRun2" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
        <Border x:Name="border" Height="Auto" Width="5" HorizontalAlignment="Center" Margin="0">
          <Path x:Name="path" Width="5" Height="3" StrokeThickness="0" Data="M0,0L5,0 2.5,3z" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0" SnapsToDevicePixels="True" Fill="{TemplateBinding Foreground}" />
        </Border>
      </StackPanel>
    </StackPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="HasTwoLines" Value="False">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="HorizontalAlignment" TargetName="stackPanel" Value="Left" />
        <Setter Property="Margin" TargetName="border" Value="0" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel" Value="Center" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Center" />
        <Setter Property="Margin" TargetName="stackPanel1" Value="3,0,0,0" />
        <Setter Property="VerticalAlignment" TargetName="stackPanel1" Value="Center" />
        <Setter Property="Visibility" TargetName="PART_TextRun2" Value="Collapsed" />
      </Trigger>
      <Trigger Property="HasGlyph" Value="False">
        <Setter Property="Visibility" TargetName="path" Value="Collapsed" />
        <Setter Property="Width" TargetName="border" Value="0.1" />
      </Trigger>
      <Trigger Property="Text" SourceName="PART_TextRun2" Value="">
        <Setter Property="Visibility" TargetName="PART_TextRun2" Value="Hidden" />
      </Trigger>
      <Trigger Property="Text" SourceName="PART_TextRun2" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="PART_TextRun2" Value="Hidden" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonTitleBarControlTemplate" TargetType="{x:Type Fluent:RibbonTitleBar}">
    <Grid>
      <ContentPresenter x:Name="PART_QuickAccessToolbarHolder" ContentSource="QuickAccessToolBar" />
      <ContentPresenter x:Name="PART_HeaderHolder" ContentSource="Header" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" IsHitTestVisible="False" />
      <Fluent:RibbonContextualGroupsContainer x:Name="PART_ItemsContainer" IsItemsHost="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" Value="Collapsed" TargetName="PART_QuickAccessToolbarHolder" />
        <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ItemsContainer" />
      </Trigger>
      <Trigger Property="HideContextTabs" Value="True">
        <Setter Property="Visibility" Value="Hidden" TargetName="PART_ItemsContainer" />
        <Setter Property="Visibility" Value="Hidden" TargetName="PART_QuickAccessToolbarHolder" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ComboBox}" x:Key="Fluent.Ribbon.Styles.Backstage.ComboBox">
    <Setter Property="Height" Value="42" />
    <Setter Property="Width" Value="229" />
    <Setter Property="IsReadOnly" Value="True" />
    <Setter Property="IsEditable" Value="False" />
  </Style>
  <ControlTemplate x:Key="Fluent.Ribbon.Templates.BackstageTabControl.Button" TargetType="{x:Type Fluent:Button}">
    <Grid Background="Transparent">
      <Border x:Name="border" Visibility="Collapsed" Background="{TemplateBinding Fluent:RibbonProperties.MouseOverBackground}" />
      <StackPanel Orientation="Horizontal" Margin="25,0,15,0" HorizontalAlignment="Left" VerticalAlignment="Center">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Margin="0 0 8 0" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" SnapsToDevicePixels="True" />
        <ContentControl x:Name="controlLabel" Focusable="False" Content="{TemplateBinding Header}">
          <ContentControl.Resources>
            <Style TargetType="TextBlock">
              <Setter Property="TextWrapping" Value="NoWrap" />
              <Setter Property="TextTrimming" Value="CharacterEllipsis" />
            </Style>
          </ContentControl.Resources>
        </ContentControl>
      </StackPanel>
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocused" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="BackstageBackButtonTemplate" TargetType="Button">
    <Grid x:Name="ContentGrid" Background="Transparent" Fluent:FrameworkHelper.UseLayoutRounding="False">
      <ContentControl Margin="{TemplateBinding Padding}" HorizontalAlignment="Left" Focusable="False">
        <Grid>
          <Path x:Name="arrowpath" Width="16" Height="12" Stretch="Uniform" Fill="{TemplateBinding Foreground}" Data="F1 M 36,22L 36,26L 19.75,26L 27,33L 20.5,33L 11,24L 20.5,15L 27,15L 19.75,22L 36,22 Z " />
          <Ellipse x:Name="backellipse" Stroke="{TemplateBinding Foreground}" Height="34" Width="34" StrokeThickness="2" />
          <Path Data="M0,0 C0,35 0,35 0,35 C0,35 35,35 35,35 L35,0 z" Fill="Transparent" HorizontalAlignment="Stretch" Margin="0" Stretch="None" Width="Auto" />
        </Grid>
      </ContentControl>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsKeyboardFocused" Value="True">
        <Setter Property="Background" TargetName="ContentGrid" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Opacity" TargetName="arrowpath" Value="0.5" />
        <Setter Property="Opacity" TargetName="backellipse" Value="0.5" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="ContentGrid" Value="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Opacity" TargetName="arrowpath" Value="0.5" />
        <Setter Property="Opacity" TargetName="backellipse" Value="0.5" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="Fluent.Ribbon.ColorGallery.ListBox.Template.Row0" TargetType="{x:Type ListBox}">
    <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
      <UniformGrid HorizontalAlignment="Left" IsItemsHost="True" Columns="{Binding Columns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}}" />
    </Border>
  </ControlTemplate>
  <ControlTemplate x:Key="Fluent.Ribbon.ColorGallery.ListBox.Template.Row1" TargetType="{x:Type ListBox}">
    <Border Background="{TemplateBinding Background}" HorizontalAlignment="Stretch">
      <UniformGrid Rows="1" HorizontalAlignment="Left" IsItemsHost="True" Columns="{Binding Columns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}}" />
    </Border>
  </ControlTemplate>
  <Fluent:ColorGradientItemTemplateSelector x:Key="ColorGradientItemTemplateSelect" />
  <Style x:Key="SeparatorTabItemStyle" TargetType="Fluent:SeparatorTabItem">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Fluent:SeparatorTabItem">
          <ContentPresenter ContentSource="Header" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Background="Transparent" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="SliderRepeatButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Grid>
      <ContentPresenter Margin="0" Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Grid>
  </ControlTemplate>
  <DrawingImage x:Key="Fluent.Ribbon.Images.ApplicationMenu" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 0,85.3333L 170.667,85.3333L 170.667,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 91.3333,71.3333L 16,71.3333C 14.5333,71.3333 13.3333,70.1333 13.3333,68.6667L 13.3333,10C 13.3333,8.53333 14.5333,7.33333 16,7.33333L 91.3333,7.33333C 92.8,7.33333 94,8.53333 94,10L 94,68.6667C 94,70.1333 92.8,71.3333 91.3333,71.3333 Z " />
          <GeometryDrawing Brush="#FF497DB1" Geometry="F1 M 41.3333,64L 37.3333,64L 37.3333,14.6667L 41.3333,14.6667M 78.8,25.3333L 53.8667,25.3333C 52.8,25.3333 52,24.5333 52,23.4667L 52,21.8667C 52,20.8 52.8,20 53.8667,20L 78.8,20C 79.8667,20 80.6667,20.8 80.6667,21.8667L 80.6667,23.4667C 80.6667,24.5333 79.8667,25.3333 78.8,25.3333 Z M 78.8,37.3333L 53.8667,37.3333C 52.8,37.3333 52,36.5333 52,35.4667L 52,33.8667C 52,32.8 52.8,32 53.8667,32L 78.8,32C 79.8667,32 80.6667,32.8 80.6667,33.8667L 80.6667,35.4667C 80.6667,36.5333 79.8667,37.3333 78.8,37.3333 Z M 78.8,48L 53.8667,48C 52.8,48 52,47.2 52,46.1333L 52,44.5333C 52,43.4667 52.8,42.6667 53.8667,42.6667L 78.8,42.6667C 79.8667,42.6667 80.6667,43.4667 80.6667,44.5333L 80.6667,46.1333C 80.6667,47.2 79.8667,48 78.8,48 Z M 78.8,58.6667L 53.8667,58.6667C 52.8,58.6667 52,57.8667 52,56.8L 52,55.2C 52,54.1333 52.8,53.3333 53.8667,53.3333L 78.8,53.3333C 79.8667,53.3333 80.6667,54.1333 80.6667,55.2L 80.6667,56.8C 80.6667,57.8667 79.8667,58.6667 78.8,58.6667 Z M 92,68.6667C 92,69.0667 91.7333,69.3333 91.3333,69.3333L 42.5333,69.3333C 42.2667,67.8667 40.9333,66.6667 39.3333,66.6667C 37.7333,66.6667 36.4,67.8667 36.1333,69.3333L 16,69.3333C 15.6,69.3333 15.3333,69.0667 15.3333,68.6667L 15.3333,10C 15.3333,9.6 15.6,9.33333 16,9.33333L 36.1333,9.33333C 36.4,10.8 37.7333,12 39.3333,12C 40.9333,12 42.2667,10.8 42.5333,9.33333L 91.3333,9.33333C 91.7333,9.33333 92,9.6 92,10M 91.3333,5.33333L 16,5.33333C 13.4667,5.33333 11.3333,7.46666 11.3333,10L 11.3333,68.6667C 11.3333,71.2 13.4667,73.3333 16,73.3333L 91.3333,73.3333C 93.8667,73.3333 96,71.2 96,68.6667L 96,10C 96,7.46666 93.8667,5.33333 91.3333,5.33333 Z " />
          <GeometryDrawing Brush="#FFD1D1D1" Geometry="F1 M 20.444,49L 30.6667,49L 30.6667,63.6667L 20.444,63.6667L 20.444,49 Z " />
          <GeometryDrawing Brush="#9AD1D1D1" Geometry="F1 M 20.444,32.556L 30.6667,32.556L 30.6667,47.2227L 20.444,47.2227L 20.444,32.556 Z " />
          <GeometryDrawing Brush="#4DD1D1D1" Geometry="F1 M 20.444,15.2227L 30.6667,15.2227L 30.6667,29.8893L 20.444,29.8893L 20.444,15.2227 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 137.867,58L 161.334,32.2667C 162.399,31.2 161.601,29.3333 160.133,29.3333L 112.399,29.3333C 111.201,29.3333 110.667,30.6667 111.466,31.6L 135.466,58C 136.133,58.6667 137.201,58.6667 137.867,58 Z " />
          <GeometryDrawing Brush="#FF497DB1" Geometry="F1 M 115.333,32L 136.667,55.3333L 158,32M 136.667,61.2C 135.467,61.2 134.267,60.6667 133.467,59.7333L 109.333,33.3333C 108.267,32.1333 108,30.5333 108.667,29.0667C 109.333,27.6 110.8,26.6667 112.267,26.6667L 160,26.6667C 161.733,26.6667 163.333,27.7333 164,29.3333C 164.667,30.9333 164.4,32.8 163.2,34L 139.733,59.7333C 139.067,60.6667 137.867,61.2 136.667,61.2 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Copy" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 4.66667,87.3333L 90,87.3333L 90,2L 4.66667,2L 4.66667,87.3333 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 52,65.3333L 9.33334,65.3333L 9.33334,9.33334L 33,9.33334L 52,26L 52,65.3333 Z ">
            <GeometryDrawing.Pen>
              <Pen Thickness="4.66667" MiterLimit="2.75" Brush="#FF515151" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 84,80L 41.3333,80L 41.3333,24L 65,24L 84,40.6667L 84,80 Z ">
            <GeometryDrawing.Pen>
              <Pen Thickness="4.66667" MiterLimit="2.75" Brush="#FF515151" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
          <GeometryDrawing Geometry="F1 M 63.3333,24L 63.3333,43.3333L 84,43.3333">
            <GeometryDrawing.Pen>
              <Pen Thickness="4.66667" MiterLimit="2.75" Brush="#FF515151" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
          <GeometryDrawing Brush="#FF497DB1" Geometry="F1 M 15.3333,27L 15.3333,28.3333C 15.3333,29.4333 16.2333,30.3333 17.3333,30.3333L 24,30.3333C 25.1,30.3333 26,29.4333 26,28.3333L 26,27C 26,25.9 25.1,25 24,25L 17.3333,25C 16.2333,25 15.3333,25.9 15.3333,27 Z M 15.3333,37.6667L 15.3333,39C 15.3333,40.1 16.2333,41 17.3333,41L 36,41C 37.1,41 38,40.1 38,39L 38,37.6667C 38,36.5667 37.1,35.6667 36,35.6667L 17.3333,35.6667C 16.2333,35.6667 15.3333,36.5667 15.3333,37.6667 Z M 17.3333,47.6667L 36,47.6667C 37.1,47.6667 38,48.5667 38,49.6667L 38,51C 38,52.1 37.1,53 36,53L 17.3333,53C 16.2333,53 15.3333,52.1 15.3333,51L 15.3333,49.6667C 15.3333,48.5667 16.2333,47.6667 17.3333,47.6667 Z " />
          <GeometryDrawing Brush="#FF497DB1" Geometry="F1 M 48.6667,40.3333L 48.6667,41.6667C 48.6667,42.7667 49.5667,43.6667 50.6667,43.6667L 57.3333,43.6667C 58.4333,43.6667 59.3333,42.7667 59.3333,41.6667L 59.3333,40.3333C 59.3333,39.2333 58.4333,38.3333 57.3333,38.3333L 50.6667,38.3333C 49.5667,38.3333 48.6667,39.2333 48.6667,40.3333 Z M 48.6667,51L 48.6667,52.3333C 48.6667,53.4333 49.5667,54.3333 50.6667,54.3333L 74,54.3333C 75.1,54.3333 76,53.4333 76,52.3333L 76,51C 76,49.9 75.1,49 74,49L 50.6667,49C 49.5667,49 48.6667,49.9 48.6667,51 Z M 50.6667,61L 74,61C 75.1,61 76,61.9 76,63L 76,64.3333C 76,65.4333 75.1,66.3333 74,66.3333L 50.6667,66.3333C 49.5667,66.3333 48.6667,65.4333 48.6667,64.3333L 48.6667,63C 48.6667,61.9 49.5667,61 50.6667,61 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Cut" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 4.66667,86L 90,86L 90,0.666664L 4.66667,0.666664L 4.66667,86 Z " />
          <GeometryDrawing Brush="#FF666666" Geometry="F1 M 66.8841,0.666664L 45.7748,29.0547L 24.6668,0.666664C 21.8641,16.544 32.7961,30.4493 39.5988,37.36L 28.2175,52.6667L 33.5508,58L 45.7748,43.3307L 58.0001,58L 63.3335,52.6667L 51.9521,37.36C 58.7548,30.4493 69.6855,16.544 66.8841,0.666664 Z " />
          <GeometryDrawing Geometry="F1 M 70.6667,80C 78.0293,80 84,74.0293 84,66.6667C 84,59.304 78.0293,53.3333 70.6667,53.3333C 63.304,53.3333 57.3333,59.304 57.3333,66.6667C 57.3333,74.0293 63.304,80 70.6667,80 Z M 10.6667,66.6667C 10.6667,59.304 16.636,53.3333 24,53.3333C 31.364,53.3333 37.3333,59.304 37.3333,66.6667C 37.3333,74.0293 31.364,80 24,80C 16.636,80 10.6667,74.0293 10.6667,66.6667 Z ">
            <GeometryDrawing.Pen>
              <Pen Thickness="5.33334" MiterLimit="2.75" Brush="#FF497DB1" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.DefaultPlaceholder" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 10.6667,96L 96,96L 96,10.6667L 10.6667,10.6667L 10.6667,96 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 17.3333,53.3333C 17.3333,33.4507 33.4507,17.3333 53.3333,17.3333C 73.216,17.3333 89.3333,33.4507 89.3333,53.3333C 89.3333,73.216 73.216,89.3333 53.3333,89.3333C 33.4507,89.3333 17.3333,73.216 17.3333,53.3333 Z " />
          <GeometryDrawing Geometry="F1 M 16,53.3333C 16,32.7147 32.7147,16 53.3333,16C 73.952,16 90.6667,32.7147 90.6667,53.3333C 90.6667,73.952 73.952,90.6667 53.3333,90.6667C 32.7147,90.6667 16,73.952 16,53.3333 Z ">
            <GeometryDrawing.Pen>
              <Pen Thickness="8" MiterLimit="2.75" Brush="#FF8099BD" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
          <GeometryDrawing Brush="#FF6F9A42" Geometry="F1 M 25.3333,53.3333C 25.3333,37.8693 37.8693,25.3333 53.3333,25.3333C 68.7973,25.3333 81.3333,37.8693 81.3333,53.3333C 81.3333,68.7973 68.7973,81.3333 53.3333,81.3333C 37.8693,81.3333 25.3333,68.7973 25.3333,53.3333 Z " />
          <GeometryDrawing Geometry="F1 M 31.25,66C 31.25,57.5307 41.1378,50.6667 53.3333,50.6667C 65.5303,50.6667 75.4167,57.5307 75.4167,66C 75.4167,74.4693 65.5303,81.3333 53.3333,81.3333C 41.1378,81.3333 31.25,74.4693 31.25,66 Z ">
            <GeometryDrawing.Brush>
              <RadialGradientBrush RadiusX="0.408531" RadiusY="0.568391" Center="0.5,0.5" GradientOrigin="0.5,0.5">
                <RadialGradientBrush.GradientStops>
                  <GradientStop Color="#6CFFFFFF" Offset="0" />
                  <GradientStop Color="#6CB7CCA0" Offset="0.539535" />
                  <GradientStop Color="#6C6F9A42" Offset="1" />
                </RadialGradientBrush.GradientStops>
                <RadialGradientBrush.RelativeTransform>
                  <TransformGroup />
                </RadialGradientBrush.RelativeTransform>
              </RadialGradientBrush>
            </GeometryDrawing.Brush>
          </GeometryDrawing>
          <GeometryDrawing Geometry="F1 M 30.6667,42.6667C 30.6667,33.0933 40.8147,25.3333 53.3333,25.3333C 65.852,25.3333 76,33.0933 76,42.6667C 76,52.24 65.852,57.6667 53.3333,57.6667C 40.8147,57.6667 30.6667,52.24 30.6667,42.6667 Z ">
            <GeometryDrawing.Brush>
              <LinearGradientBrush StartPoint="0.5,2.35961e-007" EndPoint="0.5,0.907216">
                <LinearGradientBrush.GradientStops>
                  <GradientStop Color="#CAFFFFFF" Offset="0" />
                  <GradientStop Color="#65FFFFFF" Offset="0.725581" />
                  <GradientStop Color="#00FFFFFF" Offset="1" />
                </LinearGradientBrush.GradientStops>
              </LinearGradientBrush>
            </GeometryDrawing.Brush>
          </GeometryDrawing>
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.DialogLauncher" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3331L 85.3333,85.3331L 85.3333,-0.000259399L 0,-0.000259399L 0,85.3331 Z " />
          <GeometryDrawing Brush="#FF999999" Geometry="F1 M 21.3336,10.6667L 10.6669,10.6667L 10.6669,21.3333L 10.6669,80L 21.3336,80L 21.3336,21.3333L 80.0003,21.3333L 80.0003,10.6667M 42.2283,48.436L 60.0376,66.2453L 41.3323,84.9507L 41.3323,85.3333L 85.3336,85.3333L 85.3336,41.332L 84.9509,41.332L 67.5789,58.704L 49.7709,40.8947L 42.2283,48.436 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Help" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="#FF497DB1" Geometry="F1 M 85.3333,42.6667C 85.3333,66.2307 66.2307,85.3333 42.6667,85.3333C 19.1027,85.3333 0,66.2307 0,42.6667C 0,19.1027 19.1027,0 42.6667,0C 66.2307,0 85.3333,19.1027 85.3333,42.6667 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 36.8092,57.4479C 36.8092,53.7604 37.2675,50.8229 38.1842,48.6145C 39.1009,46.427 40.9134,44.0104 43.6217,41.3854C 46.33,38.7604 48.0384,36.9062 48.7675,35.7812C 49.8717,34.0937 50.4342,32.2604 50.4342,30.2812C 50.4342,27.677 49.7884,25.677 48.4967,24.302C 47.205,22.927 45.3092,22.2395 42.8092,22.2395C 40.4134,22.2395 38.4967,22.927 37.0384,24.2604C 35.58,25.6145 34.8509,27.4479 34.8509,29.7395L 24.7259,29.7395C 24.7675,24.8229 26.455,20.9479 29.7467,18.0729C 33.0384,15.2187 37.3925,13.7812 42.8092,13.7812C 48.3925,13.7812 52.7467,15.1979 55.8717,18.0312C 58.9967,20.8645 60.5592,24.8229 60.5592,29.9062C 60.5592,34.4479 58.4342,38.9062 54.2259,43.2812L 49.1009,48.3229C 47.2675,50.4062 46.3092,53.4479 46.2675,57.4479L 36.8092,57.4479 Z M 36.1009,70.4062C 36.1009,68.7812 36.6009,67.4479 37.6425,66.427C 38.6634,65.427 40.0592,64.9062 41.8092,64.9062C 43.58,64.9062 44.9759,65.427 46.0175,66.4687C 47.0384,67.5104 47.5592,68.8229 47.5592,70.4062C 47.5592,71.9479 47.0592,73.2187 46.0592,74.2395C 45.0592,75.2812 43.6425,75.7812 41.8092,75.7812C 39.9759,75.7812 38.5592,75.2812 37.58,74.2395C 36.58,73.2187 36.1009,71.9479 36.1009,70.4062 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.MoreColors" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="#FFD76345" Geometry="F1 M 15.5469,75.6068L 38.3523,44.2188L 1.3016,32.1815C 0.454933,35.5361 0.000266667,39.0481 0.000266667,42.6668C 0.000266667,55.9308 6.0536,67.7815 15.5469,75.6068 Z " />
          <GeometryDrawing Brush="#FFE68C42" Geometry="F1 M 40,39.1459L 40,0.0912094C 23.088,1.13521 8.852,12.0272 2.94133,27.1045L 40,39.1459 Z " />
          <GeometryDrawing Brush="#FFEAC282" Geometry="F1 M 45.3333,39.1459L 82.3933,27.1045C 76.48,12.0272 62.2453,1.13521 45.3333,0.0912094L 45.3333,39.1459 Z " />
          <GeometryDrawing Brush="#FF4F82B7" Geometry="F1 M 42.6667,47.3528L 19.872,78.7261C 26.468,82.9048 34.2813,85.3328 42.6667,85.3328C 51.052,85.3328 58.8653,82.9048 65.4613,78.7261L 42.6667,47.3528 Z " />
          <GeometryDrawing Brush="#FF76A797" Geometry="F1 M 46.9817,44.2188L 69.7871,75.6068C 79.2804,67.7801 85.3337,55.9308 85.3337,42.6668C 85.3337,39.0481 84.8791,35.5361 84.0311,32.1801L 46.9817,44.2188 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Paste" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,86L 85.3333,86L 85.3333,0.666664L 0,0.666664L 0,86 Z " />
          <GeometryDrawing Brush="#FFEAC282" Geometry="F1 M 40,31.3333L 72.6667,31.3333C 74.1387,31.3333 75.3333,30.14 75.3333,28.6667L 75.3333,12.6667C 75.3333,11.1947 74.1387,10 72.6667,10L 64,10L 64,11.104L 64,18.2293C 64,22.5213 60.5213,26 56.2293,26L 23.7707,26C 19.4787,26 16,22.5213 16,18.2293L 16,11.104L 16,10L 7.33333,10C 5.86133,10 4.66667,11.1947 4.66667,12.6667L 4.66667,77.3333C 4.66667,78.8053 5.86133,80 7.33333,80L 34.6667,80C 36.1387,80 37.3333,78.8053 37.3333,77.3333L 37.3333,34C 37.3333,32.528 38.528,31.3333 40,31.3333 Z " />
          <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 82,82.6667L 47.3333,82.6667C 46.596,82.6667 46,82.0707 46,81.3333L 46,41.3333C 46,40.5973 46.596,40 47.3333,40L 68.6667,40L 83.3333,52L 83.3333,81.3333C 83.3333,82.0707 82.7373,82.6667 82,82.6667 Z " />
          <GeometryDrawing Geometry="F1 M 68.6667,40L 68.6667,52L 84,52M 82,82.6667L 47.3333,82.6667C 46.596,82.6667 46,82.0707 46,81.3333L 46,41.3333C 46,40.5973 46.596,40 47.3333,40L 68.6667,40L 83.3333,52L 83.3333,81.3333C 83.3333,82.0707 82.7373,82.6667 82,82.6667 Z ">
            <GeometryDrawing.Pen>
              <Pen Thickness="4" MiterLimit="2.75" Brush="#FF666666" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
          <GeometryDrawing Brush="#FF666666" Geometry="F1 M 40,14.6667C 37.4227,14.6667 35.3333,12.5773 35.3333,10C 35.3333,7.42267 37.4227,5.33333 40,5.33333C 42.5773,5.33333 44.6667,7.42267 44.6667,10C 44.6667,12.5773 42.5773,14.6667 40,14.6667 Z M 56.2293,8.66666L 49.228,8.66666C 48.5787,4.14533 44.7,0.666664 40,0.666664C 35.3,0.666664 31.4213,4.14533 30.7733,8.66666L 23.7707,8.66666C 22.424,8.66666 21.3333,9.75733 21.3333,11.104L 21.3333,18.2293C 21.3333,19.576 22.424,20.6667 23.7707,20.6667L 56.2293,20.6667C 57.576,20.6667 58.6667,19.576 58.6667,18.2293L 58.6667,11.104C 58.6667,9.75733 57.576,8.66666 56.2293,8.66666 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Warning" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup>
          <DrawingGroup.Children>
            <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
            <GeometryDrawing Brush="#FFE9C281" Geometry="F1 M 37.5892,9.95308L 2.41053,70.8837C 0.154533,74.7931 2.97587,79.6784 7.48787,79.6784L 77.8452,79.6784C 82.3585,79.6784 85.1799,74.7931 82.9225,70.8837L 47.7452,9.95308C 45.4865,6.04373 39.8452,6.04373 37.5892,9.95308 Z " />
            <GeometryDrawing Brush="#FF333333" Geometry="F1 M 37.9675,54.0599L 37.9675,25.1849L 48.2592,25.1849L 48.2592,54.0599L 37.9675,54.0599 Z M 49.1342,63.3933C 49.1342,64.2266 48.9675,64.9974 48.655,65.7058C 48.3425,66.4141 47.905,67.0391 47.3633,67.5391C 46.8217,68.0391 46.1758,68.4558 45.4467,68.7474C 44.6967,69.0391 43.9258,69.2058 43.1133,69.2058C 42.28,69.2058 41.5092,69.0599 40.8008,68.7683C 40.0925,68.4974 39.4675,68.1016 38.9467,67.5599C 38.405,67.0391 37.9883,66.4349 37.655,65.7266C 37.3217,65.0391 37.155,64.2891 37.155,63.4558C 37.155,62.6849 37.3008,61.9349 37.6133,61.2266C 37.9258,60.5183 38.3425,59.8933 38.8842,59.3516C 39.405,58.8099 40.03,58.3933 40.78,58.0808C 41.5092,57.7891 42.28,57.6224 43.1133,57.6224C 43.9258,57.6224 44.6967,57.7891 45.4467,58.0808C 46.1758,58.3933 46.8217,58.8099 47.3633,59.3099C 47.905,59.8308 48.3425,60.4558 48.655,61.1641C 48.9675,61.8724 49.1342,62.6224 49.1342,63.3933 Z " />
          </DrawingGroup.Children>
        </DrawingGroup>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  <ControlTemplate x:Key="RibbonWindowControlTemplate" TargetType="{x:Type Fluent:RibbonWindow}">
    <Grid LayoutTransform="{Binding LayoutTransform, RelativeSource={RelativeSource TemplatedParent}}" RenderTransform="{Binding RenderTransform, RelativeSource={RelativeSource TemplatedParent}}">
      <AdornerDecorator x:Name="Adorner">
        <Grid Background="{TemplateBinding Background}">
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
          </Grid.RowDefinitions>
          <DockPanel Grid.Row="0" Height="{TemplateBinding TitleBarHeight}" VerticalAlignment="Top" HorizontalAlignment="Stretch" Background="{TemplateBinding TitleBackground}" LastChildFill="True">
            <Image x:Name="PART_Icon" DockPanel.Dock="Left" Height="16" Width="16" Margin="4,2,0,0" VerticalAlignment="{TemplateBinding VerticalIconAlignment}" Stretch="Uniform" Visibility="{TemplateBinding IsIconVisible, Converter={StaticResource BooleanToVisibilityConverter}}" Source="{Fluent:IconConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, {Binding RelativeSource={RelativeSource Self}}}" SnapsToDevicePixels="True" />
            <ContentPresenter x:Name="PART_WindowCommands" DockPanel.Dock="Right" Content="{TemplateBinding WindowCommands}" Grid.Row="0" Panel.ZIndex="1" HorizontalAlignment="Right" />
            <Fluent:RibbonTitleBar x:Name="PART_RibbonTitleBar" Header="{TemplateBinding Title}" IsCollapsed="{TemplateBinding IsCollapsed}" Foreground="{TemplateBinding TitleForeground}" />
          </DockPanel>
          <ContentPresenter x:Name="PART_ContentPresenter" Grid.Row="1" />
        </Grid>
      </AdornerDecorator>
      <Border x:Name="PART_Border" Background="{x:Null}" BorderBrush="{TemplateBinding GlowBrush}" BorderThickness="{TemplateBinding BorderThickness}" UseLayoutRounding="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
      <ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsActive" Value="False">
        <Setter Property="Opacity" TargetName="PART_WindowCommands" Value="0.5" />
        <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding Path=NonActiveGlowBrush, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsActive" Value="False" />
          <Condition Property="NonActiveGlowBrush" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding Path=NonActiveBorderBrush, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsActive" Value="True" />
          <Condition Property="GlowBrush" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding Path=BorderBrush, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="ResizeMode" Value="CanResizeWithGrip" />
          <Condition Property="WindowState" Value="Normal" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_Border" Value="Visible" />
        <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="WindowState" Value="Maximized">
        <Setter Property="Margin" TargetName="Adorner" Value="0" />
        <Setter Property="Margin" TargetName="PART_Icon" Value="2,2,0,0" />
        <Setter Property="Visibility" TargetName="PART_Border" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <theming:RibbonLibraryThemeProvider x:Key="{x:Static theming:RibbonLibraryThemeProvider.DefaultInstance}" />
  <Thickness x:Key="Fluent.Ribbon.Values.RibbonTabControl.Content.BorderThickness">0</Thickness>
  <ControlTemplate x:Key="Fluent.Ribbon.Templates.WindowCommands.CaptionButton" TargetType="{x:Type Button}">
    <Grid Background="{TemplateBinding Background}">
      <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="False">
        <Setter TargetName="contentPresenter" Property="Opacity" Value="0.75" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.WhiteBrush}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.WindowCommands.CaptionButton" TargetType="{x:Type Button}">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Foreground}" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="1" />
    <Setter Property="Width" Value="46" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.Templates.WindowCommands.CaptionButton}" />
    <Style.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Pressed.Background}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="RibbonButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Height="Auto">
      <StackPanel x:Name="stackPanel" Width="Auto" Margin="{TemplateBinding Padding}" Orientation="Vertical">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="0 2 0 0" SnapsToDevicePixels="True" />
        <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0" />
      </StackPanel>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,0,2,0" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,0,2,0" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonButtonStyle" TargetType="{x:Type Fluent:Button}">
    <Setter Property="Template" Value="{DynamicResource RibbonButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
    <Setter Property="BorderThickness" Value="1" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="Fluent.Ribbon.Templates.WindowCommands" TargetType="Fluent:WindowCommands">
    <StackPanel Orientation="Horizontal">
      <ItemsControl x:Name="PART_Items" ItemsSource="{Binding Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}" ItemContainerStyleSelector="{TemplateBinding ItemContainerStyleSelector}" Visibility="{TemplateBinding ItemsPanelVisibility}" Focusable="False" Margin="0 0 2 0">
        <ItemsControl.ItemsPanel>
          <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal" />
          </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
      </ItemsControl>
      <Button x:Name="PART_Min" Focusable="False" Style="{DynamicResource Fluent.Ribbon.Styles.WindowCommands.CaptionButton}" Padding="0" ToolTip="{Binding Minimize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Uid="{Binding Minimize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" SnapsToDevicePixels="True">
        <Path Data="F1M3,8L13,8 13,7 3,7z" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
      </Button>
      <Button x:Name="PART_Max" Focusable="False" Style="{DynamicResource Fluent.Ribbon.Styles.WindowCommands.CaptionButton}" Padding="0" Visibility="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Converter={x:Static converters:StaticConverters.EqualsToVisibilityConverter}, ConverterParameter={x:Static WindowState.Normal}}" ToolTip="{Binding Maximize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Uid="{Binding Maximize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" SnapsToDevicePixels="True">
        <Path Data="F1M12,12L4,12 4,4 12,4z M3,13L13,13 13,3 3,3z" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
      </Button>
      <Button x:Name="PART_Restore" Focusable="False" Style="{DynamicResource Fluent.Ribbon.Styles.WindowCommands.CaptionButton}" Padding="0" Visibility="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Converter={x:Static converters:StaticConverters.EqualsToVisibilityConverter}, ConverterParameter={x:Static WindowState.Maximized}}" ToolTip="{Binding Restore, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Uid="{Binding Restore, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" SnapsToDevicePixels="True">
        <Path Data="F1M11.999,10.002L10.998,10.002 10.998,5.002 5.998,5.002 5.998,4.001 11.999,4.001z M10.002,11.999L4.001,11.999 4.001,5.998 10.002,5.998z M5.002,3L5.002,5.002 3,5.002 3,13 10.998,13 10.998,10.998 13,10.998 13,3z" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
      </Button>
      <Button x:Name="PART_Close" Focusable="False" Style="{DynamicResource Fluent.Ribbon.Styles.WindowCommands.CaptionButton}" Padding="0" ToolTip="{Binding Close, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" Uid="{Binding Close, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:WindowCommands}}}" SnapsToDevicePixels="True">
        <Path Data="F1M8.583,8L13,12.424 12.424,13 8,8.583 3.576,13 3,12.424 7.417,8 3,3.576 3.576,3 8,7.417 12.424,3 13,3.576z" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
      </Button>
    </StackPanel>
    <ControlTemplate.Triggers>
      <DataTrigger Binding="{Binding ResizeMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="NoResize">
        <Setter Property="Visibility" TargetName="PART_Min" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_Max" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed" />
      </DataTrigger>
      <DataTrigger Binding="{Binding ResizeMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="CanMinimize">
        <Setter Property="Visibility" TargetName="PART_Max" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_Restore" Value="Collapsed" />
      </DataTrigger>
      <DataTrigger Binding="{Binding IsMouseOver, ElementName=PART_Close}" Value="True">
        <Setter TargetName="PART_Close" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CloseButton.MouseOver.Background}" />
      </DataTrigger>
      <DataTrigger Binding="{Binding IsPressed, ElementName=PART_Close}" Value="True">
        <Setter TargetName="PART_Close" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.WindowCommands.CloseButton.Pressed.Background}" />
      </DataTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:WindowCommands}">
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.Templates.WindowCommands}" />
  </Style>
  <ControlTemplate x:Key="Fluent.Ribbon.Templates.WindowCommands.Button" TargetType="{x:Type Button}">
    <Grid Background="{TemplateBinding Background}">
      <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Margin="11,1,11,1" />
      <Rectangle x:Name="border" SnapsToDevicePixels="True" IsHitTestVisible="False" Opacity="0.25" Width="0" Height="15" VerticalAlignment="Stretch" HorizontalAlignment="Right" Fill="{TemplateBinding Foreground}" Margin="10,0,0,0" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter TargetName="contentPresenter" Property="Opacity" Value="1" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="False">
        <Setter TargetName="contentPresenter" Property="Opacity" Value=".75" />
      </Trigger>
      <Trigger Property="IsKeyboardFocused" Value="True" />
      <Trigger Property="ToggleButton.IsChecked" Value="True" />
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.DarkIdealForegroundDisabledBrush}" />
      </Trigger>
      <DataTrigger Binding="{Binding RelativeSource={RelativeSource PreviousData}}" Value="{x:Null}">
        <Setter TargetName="border" Property="Rectangle.Width" Value="1" />
      </DataTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.WindowCommands.Button" TargetType="{x:Type Button}">
    <Setter Property="Background" Value="{DynamicResource TransparentWhiteBrush}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="HorizontalContentAlignment" Value="Center" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="1" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.Templates.WindowCommands.Button}" />
  </Style>
  <Style x:Key="ControlStyleEmptyFocus" TargetType="{x:Type Control}">
    <Setter Property="Template" Value="{DynamicResource ControlFocusEmptyTemplate}" />
  </Style>
  <ControlTemplate x:Key="BackstageToggleButtonControlTemplate" TargetType="{x:Type Fluent:Backstage}">
    <Border x:Name="border2" MinWidth="60" Height="Auto" Background="{TemplateBinding Background}" Margin="0,0,0,0">
      <Grid>
        <Rectangle x:Name="rectangle" />
        <ContentPresenter x:Name="contentPresenter" ContentSource="Header" Margin="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" />
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource HighTransparentWhiteBrush}" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="border2" Value="0.5" />
        <Setter Property="Effect" TargetName="contentPresenter">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsOpen" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="border2" />
          <Condition Property="IsOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonBackstageStyle" TargetType="{x:Type Fluent:Backstage}">
    <Setter Property="Template" Value="{DynamicResource BackstageToggleButtonControlTemplate}" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="Header" Value="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.BackstageButtonText, Mode=OneWay}" />
    <Setter Property="Fluent:KeyTip.Keys" Value="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.BackstageButtonKeyTip, Mode=OneWay}" />
    <Setter Property="AreAnimationsEnabled" Value="{DynamicResource {x:Static SystemParameters.ClientAreaAnimationKey}}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Backstage.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.Backstage.Foreground}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:RibbonTabItem}" x:Key="RibbonTabItemControlTemplate">
    <Grid x:Name="grid" Height="Auto">
      <Border x:Name="groupBorder" Margin="0,0,0,1" BorderThickness="0" Background="{Binding Group.Background, RelativeSource={RelativeSource TemplatedParent}, FallbackValue=Transparent}" OpacityMask="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Contextual.Background.OpacityMask}" />
      <Border x:Name="selectedBorder" Visibility="Collapsed" VerticalAlignment="Stretch" BorderBrush="{TemplateBinding ActiveTabBorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding ActiveTabBackground}" />
      <Border x:Name="mouseOverBorder" BorderThickness="0" Background="{TemplateBinding Background}" />
      <Border x:Name="PART_ContentContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="{TemplateBinding HeaderPadding}">
        <ContentControl x:Name="PART_HeaderContentHost" Focusable="False" AutomationProperties.Name="{TemplateBinding Header}" AutomationProperties.AutomationId="{TemplateBinding Name}" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" />
      </Border>
      <Grid x:Name="separatorGrid" Margin="0" Visibility="Collapsed" HorizontalAlignment="Right" Width="1">
        <Rectangle x:Name="separatorRectangle1" Fill="{TemplateBinding BorderBrush}" Stroke="{TemplateBinding BorderBrush}" Margin="0" Width="1" />
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="PART_ContentContainer" Value="0.5" />
      </Trigger>
      <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Fluent:RibbonTabControl}, Path=SelectedItem}" Value="{x:Null}">
        <Setter TargetName="groupBorder" Property="Margin" Value="0" />
      </DataTrigger>
      <Trigger Property="IsSeparatorVisible" Value="True">
        <Setter Property="Visibility" TargetName="separatorGrid" Value="Visible" />
        <Setter Property="Margin" TargetName="selectedBorder" Value="0,0,1,0" />
      </Trigger>
      <Trigger Property="Group" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="groupBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Selector.IsSelected" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <!-- Foreground for Selected, with group -->
      <Trigger Property="Selector.IsSelected" Value="True">
        <Setter Property="Foreground" Value="{Binding Group.TabItemSelectedForeground, RelativeSource={RelativeSource Self}}" />
      </Trigger>
      <!-- Foreground for selected, no group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="Group" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Selected.Foreground}" />
      </MultiTrigger>
      <!-- Background and foreground for MouseOver, with group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" SourceName="grid" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" Value="{Binding Path=(Fluent:RibbonProperties.MouseOverBackground), RelativeSource={RelativeSource Self}}" />
        <Setter Property="Foreground" Value="{Binding Group.TabItemMouseOverForeground, RelativeSource={RelativeSource Self}}" />
      </MultiTrigger>
      <!-- Foreground for selected MouseOver, with group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" SourceName="grid" Value="True" />
          <Condition Property="Selector.IsSelected" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Foreground" Value="{Binding Group.TabItemSelectedMouseOverForeground, RelativeSource={RelativeSource Self}}" />
      </MultiTrigger>
      <!-- Background and foreground for MouseOver, no group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" SourceName="grid" Value="True" />
          <Condition Property="Group" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" Value="{Binding Path=(Fluent:RibbonProperties.MouseOverBackground), RelativeSource={RelativeSource Self}}" />
        <Setter Property="Foreground" Value="{Binding Path=(Fluent:RibbonProperties.MouseOverForeground), RelativeSource={RelativeSource Self}}" />
      </MultiTrigger>
      <!-- Background for Selected, Minimized, IsOpen, with group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
          <Condition Property="IsOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="grid" Value="Transparent" />
      </MultiTrigger>
      <!-- Background for Selected, Minimized, IsOpen, no group -->
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Selector.IsSelected" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
          <Condition Property="IsOpen" Value="True" />
          <Condition Property="Group" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="grid" Value="Transparent" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonTabItemStyle" TargetType="{x:Type Fluent:RibbonTabItem}">
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="Height" Value="Auto" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="IsMinimized" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsMinimized, Mode=OneWay, FallbackValue=False}" />
    <Setter Property="IsOpen" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:RibbonTabControl}}, Path=IsDropDownOpen, Mode=OneWay, FallbackValue=True}" />
    <Setter Property="Template" Value="{DynamicResource RibbonTabItemControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Foreground}" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush}" />
    <Setter Property="ActiveTabBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Active.Background}" />
    <Setter Property="ActiveTabBorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush}" />
    <Setter Property="Fluent:RibbonProperties.MouseOverBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.MouseOver.Background}" />
    <Setter Property="Fluent:RibbonProperties.MouseOverForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.MouseOver.Foreground}" />
    <Setter Property="HeaderTemplate">
      <Setter.Value>
        <DataTemplate>
          <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
        </DataTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Group" Value="{x:Null}">
        <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush}" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Fluent:RibbonProperties.MouseOverForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Selected.MouseOver.Foreground}" />
      </Trigger>
      <MultiDataTrigger>
        <MultiDataTrigger.Conditions>
          <Condition Binding="{Binding IsContextual, RelativeSource={RelativeSource Self}}" Value="True" />
          <Condition Binding="{Binding Group.Visibility, RelativeSource={RelativeSource Self}}" Value="Collapsed" />
        </MultiDataTrigger.Conditions>
        <Setter Property="Visibility" Value="Collapsed" />
      </MultiDataTrigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="RibbonTabControlToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="Transparent" BorderBrush="Transparent" Height="22" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="22">
      <ContentPresenter x:Name="iconImage" Width="16" Height="16" Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" SnapsToDevicePixels="True" />
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonTabControlToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{DynamicResource RibbonTabControlToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="22" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="CanAddToQuickAccessToolBar" Value="False" />
  </Style>
  <Style TargetType="Separator" x:Key="GroupBoxSeparator">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Separator.Background}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
          <Border Width="1" Height="55" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,5,2,10" Background="{TemplateBinding Background}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="DialogLauncherButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
    <Border x:Name="outerBorder" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
      <Image x:Name="image" Width="8" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.DialogLauncher}" SnapsToDevicePixels="True" />
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="FlowDirection" Value="RightToLeft">
        <Setter Property="RenderTransform" TargetName="image">
          <Setter.Value>
            <ScaleTransform ScaleX="-1" />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Background" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
        <Setter Property="BorderBrush" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ToolTipStyle" TargetType="{x:Type ToolTip}">
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.ScreenTip.Background}" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.ScreenTip.BorderBrush}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToolTip}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*" />
              <ColumnDefinition Width="5" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="5" />
            </Grid.RowDefinitions>
            <Border Grid.RowSpan="1" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
              <ContentPresenter Margin="4,4,4,4" />
            </Border>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:ScreenTip}" x:Key="ScreenTipControlTemplate">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="5" />
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="5" />
      </Grid.RowDefinitions>
      <Border Grid.RowSpan="1" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
        <Grid>
          <StackPanel x:Name="screenTipPanel">
            <TextBlock x:Name="title" TextWrapping="Wrap" Margin="7,8,7,10" FontWeight="Bold" Text="{TemplateBinding Property=Title}" />
            <Grid x:Name="imageAndTextSection">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
              <Image x:Name="image" Margin="7,5,3,7" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" Source="{TemplateBinding Property=Image}" MaxHeight="48" />
              <TextBlock Text="{TemplateBinding Property=Text}" TextWrapping="Wrap" Margin="8,0,8,6" Grid.Column="1" />
            </Grid>
            <Border x:Name="separator" Height="2" Width="Auto" HorizontalAlignment="Stretch" Visibility="{Binding ElementName=disableReasonSection, Path=Visibility}" Margin="5" Background="{DynamicResource GrayBrush6}" BorderThickness="0,0,0,1" IsEnabled="{Binding Path=IsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Control, AncestorLevel=2}}" />
            <Grid x:Name="disableReasonSection">
              <Image Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Warning}" />
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock x:Name="disableReasonHeader" x:Uid="disableReasonHeader" Text="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.ScreenTipDisableReasonHeader, Mode=OneWay}" TextWrapping="Wrap" Margin="28,0,5,2" HorizontalAlignment="Stretch" Grid.Row="0" FontWeight="Bold" />
                <TextBlock x:Name="disableReasonText" Text="{TemplateBinding Property=DisableReason}" TextWrapping="Wrap" Margin="28,0,5,6" HorizontalAlignment="Stretch" Grid.Row="1" />
                <TextBlock x:Name="helpText" TextWrapping="Wrap" Margin="28,0,5,6" Grid.RowSpan="1" Grid.Row="2" HorizontalAlignment="Stretch" Text="{Binding Text, ElementName=textBlock, Mode=Default}" />
              </Grid>
            </Grid>
            <Border x:Name="separator2" Height="2" Width="Auto" HorizontalAlignment="Stretch" Visibility="{TemplateBinding Property=HelpLabelVisibility}" Margin="5" Background="{DynamicResource GrayBrush6}" BorderThickness="0,0,0,1" />
            <Grid x:Name="helpSection" Visibility="{TemplateBinding Property=HelpLabelVisibility}">
              <Image Width="16" Height="16" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Help}" />
              <TextBlock x:Uid="HelpText" x:Name="textBlock" Text="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.ScreenTipF1LabelHeader, Mode=OneWay}" TextWrapping="Wrap" Margin="28,0,6,6" FontWeight="Bold" HorizontalAlignment="Stretch" />
              <ContentControl x:Name="helpTopic" Content="{TemplateBinding Property=HelpTopic}" Visibility="Collapsed" />
            </Grid>
          </StackPanel>
        </Grid>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" SourceName="separator" Value="False">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" SourceName="separator" Value="True">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Content" SourceName="helpTopic" Value="{x:Null}" />
          <Condition Property="Text" Value="" SourceName="disableReasonText" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="separator" Value="Collapsed" />
      </MultiTrigger>
      <Trigger Property="Text" SourceName="disableReasonText" Value="">
        <Setter Property="Visibility" TargetName="disableReasonSection" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Content" SourceName="helpTopic" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="helpText" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="helpSection" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="separator2" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Visibility" SourceName="disableReasonSection" Value="Visible">
        <Setter Property="Visibility" TargetName="helpText" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Text" Value="" />
          <Condition Property="Image" Value="{x:Null}" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="imageAndTextSection" Value="Collapsed" />
      </MultiTrigger>
      <Trigger Property="Image" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="image" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ScreenTipStyle" TargetType="{x:Type Fluent:ScreenTip}">
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.ScreenTip.Background}" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.ScreenTip.BorderBrush}" />
    <Setter Property="Width" Value="205" />
    <Setter Property="Template" Value="{DynamicResource ScreenTipControlTemplate}" />
  </Style>
  <Style x:Key="TwoLineLabelStyle" TargetType="{x:Type Fluent:TwoLineLabel}">
    <Setter Property="Template" Value="{DynamicResource TwoLineLabelControlTemplate}" />
  </Style>
  <ControlTemplate x:Key="RibbonToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Height="Auto">
      <StackPanel x:Name="stackPanel" Width="Auto" Margin="{TemplateBinding Padding}" Orientation="Vertical">
        <ContentPresenter x:Name="iconImage" Width="32" Height="32" Margin="0 2 0 0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" SnapsToDevicePixels="True" />
        <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 0" />
      </StackPanel>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-2,2,2" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.BorderBrush}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.CheckedMouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.CheckedMouseOver.BorderBrush}" />
      </MultiTrigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="InnerButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="0" Background="Transparent" BorderBrush="Transparent" Height="Auto" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" SnapsToDevicePixels="False">
      <Grid Height="Auto">
        <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed" />
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical" HorizontalAlignment="Stretch" SnapsToDevicePixels="True">
          <ContentPresenter x:Name="iconImage" Margin="0,1,0,0" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2,0,2,2" Visibility="Collapsed" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Collapsed" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,0,2,1" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,0,-1,1" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,0,2,0" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Visibility" TargetName="controlLabel" Value="Visible" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="CheckBoxControlTemplate" TargetType="{x:Type Fluent:CheckBox}">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="16" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid HorizontalAlignment="Left" VerticalAlignment="Center">
        <Border x:Name="border" Width="13" Height="13" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
          <Grid>
            <Path x:Name="CheckIcon" Width="7.5" Height="6.9" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M48.4375,110.4375 L51.4995,112.812 L56.3745,107.24883" Fluent:FrameworkHelper.UseLayoutRounding="False" Opacity="0" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.HighlightBrush}" StrokeEndLineCap="Triangle" StrokeStartLineCap="Triangle" StrokeThickness="1.5" />
            <Rectangle x:Name="IndeterminateIcon" Width="7" Height="7" Opacity="0" Fill="{DynamicResource GrayBrush2}" />
            <Rectangle x:Name="DisabledVisualElement" Fill="{DynamicResource WhiteBrush}" Opacity="0" RadiusX="1" RadiusY="1" />
          </Grid>
        </Border>
      </Grid>
      <ContentControl Grid.Column="1" IsTabStop="False" Margin="2,0,0,0" Foreground="{TemplateBinding Foreground}">
        <ContentPresenter x:Name="contentPresenter" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True" />
      </ContentControl>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
        <Setter TargetName="border" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter TargetName="CheckIcon" Property="Stroke" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.MouseOver.Stroke}" />
        <Setter TargetName="IndeterminateIcon" Property="Fill" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.MouseOver.Stroke}" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter TargetName="border" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
        <Setter TargetName="CheckIcon" Property="Stroke" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.Pressed.Stroke}" />
        <Setter TargetName="IndeterminateIcon" Property="Fill" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.Pressed.Stroke}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="contentPresenter" Property="Opacity" Value=".55" />
        <Setter TargetName="DisabledVisualElement" Property="Opacity" Value=".55" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter TargetName="CheckIcon" Property="Opacity" Value="1" />
      </Trigger>
      <Trigger Property="IsChecked" Value="{x:Null}">
        <Setter TargetName="IndeterminateIcon" Property="Opacity" Value="1" />
      </Trigger>
      <Trigger Property="FlowDirection" Value="RightToLeft">
        <Setter TargetName="CheckIcon" Property="LayoutTransform">
          <Setter.Value>
            <ScaleTransform ScaleX="-1" />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonCheckBoxStyle" TargetType="{x:Type Fluent:CheckBox}">
    <Setter Property="ToolTipService.ShowDuration" Value="30000" />
    <Setter Property="Template" Value="{DynamicResource CheckBoxControlTemplate}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.BorderBrush}" />
    <Setter Property="Margin" Value="2,2,2,2" />
  </Style>
  <Style x:Key="{x:Type Fluent:RadioButton}" TargetType="{x:Type Fluent:RadioButton}">
    <Setter Property="ToolTipService.ShowDuration" Value="30000" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.Background}" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.CheckBox.BorderBrush}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="FocusVisualStyle">
      <Setter.Value>
        <Style>
          <Setter Property="Control.Template">
            <Setter.Value>
              <ControlTemplate>
                <Rectangle Margin="1" SnapsToDevicePixels="true" Stroke="{DynamicResource BlackBrush}" StrokeDashArray="1 2" StrokeThickness="1" />
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:RadioButton}">
          <BulletDecorator SnapsToDevicePixels="true" Background="Transparent" x:Name="bulletDecorator" Height="22">
            <BulletDecorator.Bullet>
              <Grid Width="12" Height="12" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,4,0,0">
                <Rectangle Margin="-6,0" Fill="{DynamicResource TransparentWhiteBrush}" />
                <Ellipse x:Name="normal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" />
                <Ellipse x:Name="Checked1" Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="{DynamicResource Fluent.Ribbon.Brushes.HighlightBrush}" Opacity="0" />
              </Grid>
            </BulletDecorator.Bullet>
            <TextBlock Text="{TemplateBinding Header}" Margin="8,3,4,0" />
          </BulletDecorator>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="normal" Property="Stroke" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="normal" Property="Stroke" Value="{DynamicResource Fluent.Ribbon.Brushes.HighlightBrush}" />
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
              <Setter Property="Opacity" TargetName="Checked1" Value="1" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="bulletDecorator" Value="0.3" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="GalleryGroupContainerTemplate" TargetType="{x:Type Fluent:GalleryGroupContainer}">
    <DockPanel LastChildFill="True">
      <Grid DockPanel.Dock="Top" Height="21" x:Name="headerGrid" Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryGroupContainer.Header.Background}" VerticalAlignment="Top">
        <TextBlock Margin="7,0" Text="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
      </Grid>
      <Fluent:UniformGridWithItemSize IsItemsHost="True" HorizontalAlignment="Left" Orientation="{TemplateBinding Orientation}" MinColumns="{TemplateBinding MinItemsInRow}" MaxColumns="{TemplateBinding MaxItemsInRow}" ItemWidth="{TemplateBinding ItemWidth}" ItemHeight="{TemplateBinding ItemHeight}" />
    </DockPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="IsHeadered" Value="False">
        <Setter TargetName="headerGrid" Property="Visibility" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryGroupContainerStyle" TargetType="{x:Type Fluent:GalleryGroupContainer}">
    <Setter Property="Template" Value="{DynamicResource GalleryGroupContainerTemplate}" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Focusable" Value="False" />
    <Style.Triggers>
      <Trigger Property="IsHeadered" Value="False">
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ScrollButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Border Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollViewer.Button.Background}">
      <Border x:Name="OuterBorder" BorderThickness="1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollViewer.Button.BorderBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollViewer.Button.Background}">
        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="OuterBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="OuterBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="Background" TargetName="OuterBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="OuterBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ScrollButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{DynamicResource ScrollButtonControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
  </Style>
  <Style x:Key="RibbonScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
            </RepeatButton>
            <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="RibbonTabScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
          <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
            <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}" Margin="0">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
            </RepeatButton>
            <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}" Margin="0">
              <RepeatButton.Visibility>
                <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                  <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                </MultiBinding>
              </RepeatButton.Visibility>
              <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
            </RepeatButton>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <ControlTemplate TargetType="{x:Type ScrollViewer}" x:Key="MenuScrollViewerControlTemplate">
    <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
      <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
      <RepeatButton ClickMode="Hover" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Stretch" Width="Auto" Height="12" VerticalAlignment="Top" Style="{DynamicResource ScrollButtonStyle}">
        <RepeatButton.Visibility>
          <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
          </MultiBinding>
        </RepeatButton.Visibility>
        <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="5" Height="3" Data="M0,0L1,-1 2,0z" Fill="{DynamicResource BlackBrush}" />
      </RepeatButton>
      <RepeatButton ClickMode="Hover" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Stretch" Width="Auto" Height="12" VerticalAlignment="Bottom" Style="{DynamicResource ScrollButtonStyle}">
        <RepeatButton.Visibility>
          <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedVerticalScrollBarVisibility" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="VerticalOffset" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentHeight" />
            <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportHeight" />
          </MultiBinding>
        </RepeatButton.Visibility>
        <Path Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="5" Height="3" Data="M0,0L1,1 2,0z" Fill="{DynamicResource BlackBrush}" />
      </RepeatButton>
    </Grid>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.RibbonGroupsContainerScrollViewer" TargetType="{x:Type Fluent:RibbonGroupsContainerScrollViewer}" BasedOn="{StaticResource RibbonScrollViewer}" />
  <ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
      <Grid x:Name="Grid" Background="{TemplateBinding Background}">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1" />
        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0" />
        <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" />
        <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" />
      </Grid>
    </Border>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonContextualTabGroupControlTemplate" TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
    <Border x:Name="rootBorder" Visibility="{TemplateBinding InnerVisibility}" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto">
      <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0" VerticalAlignment="Stretch" Height="Auto">
        <Grid Margin="0" VerticalAlignment="Stretch" Height="Auto">
          <Rectangle Fill="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" OpacityMask="{DynamicResource Fluent.Ribbon.Brushes.RibbonContextualTabGroup.Background.OpacityMask}" />
          <Rectangle Fill="{TemplateBinding BorderBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto" Height="4" />
          <Grid Margin="0,4,0,0">
            <TextBlock Text="{TemplateBinding Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0" TextTrimming="CharacterEllipsis" Foreground="{TemplateBinding Foreground}" />
          </Grid>
        </Grid>
      </Border>
    </Border>
  </ControlTemplate>
  <Style x:Key="RibbonTitleBarStyle" TargetType="{x:Type Fluent:RibbonTitleBar}">
    <Setter Property="Template" Value="{DynamicResource RibbonTitleBarControlTemplate}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="HeaderTemplate">
      <Setter.Value>
        <DataTemplate>
          <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
        </DataTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="KeyTipStyle" TargetType="{x:Type Fluent:KeyTip}">
    <Setter Property="Foreground" Value="{DynamicResource WhiteBrush}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.KeyTip.Background}" />
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.KeyTip.BorderBrush}" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:KeyTip}">
          <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
            <TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4,-1,4,1" />
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" Value="0.5" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ResizeBothThumbControlTemplate" TargetType="{x:Type Thumb}">
    <Grid Background="Transparent">
      <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" Width="2" Height="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,2,1" />
      <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,2,5" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,6,1" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,2" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,3,6" VerticalAlignment="Bottom" Width="2" Height="2" />
      <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Right" Margin="0,0,7,2" VerticalAlignment="Bottom" Width="2" Height="2" />
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="ResizeVerticalThumbControlTemplate" TargetType="{x:Type Thumb}">
    <Grid Background="Transparent">
      <StackPanel Margin="0,1,0,0" Orientation="Horizontal" d:LayoutOverrides="Height" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
        <Grid HorizontalAlignment="Left" Margin="1,0,0,0" Width="Auto" Height="Auto">
          <Rectangle Fill="{DynamicResource WhiteBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="2" Height="2" />
          <Rectangle Fill="{DynamicResource BlackBrush}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0,0,1,1" VerticalAlignment="Center" Width="2" Height="2" />
        </Grid>
      </StackPanel>
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuSeparatorControlTemplate" TargetType="{x:Type Separator}">
    <Grid Height="Auto">
      <Path Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" StrokeDashArray="2 2" Margin="32,1,3,2" VerticalAlignment="Center" Height="1" Data="M0,0L1,0" />
    </Grid>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuGroupSeparatorControlTemplate" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
    <Grid Height="Auto" Background="{DynamicResource Fluent.Ribbon.Brushes.GroupSeparator.Background}">
      <TextBlock Margin="7,0" Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" />
    </Grid>
  </ControlTemplate>
  <Style x:Key="GalleryDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:DropDownButton}">
          <Grid>
            <Border x:Name="PART_ButtonBorder" Background="Transparent">
              <Fluent:TwoLineLabel x:Name="twoLineLabel" Text="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}" HasTwoLines="False" HasGlyph="True" Foreground="{DynamicResource WhiteBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,-2,0,0" />
            </Border>
            <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
              <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
                <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                  <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                    <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
                    <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                      <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                      <ScrollViewer Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                        <StackPanel x:Name="PART_MenuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                      </ScrollViewer>
                    </Grid>
                  </Grid>
                </Border>
              </Grid>
            </Popup>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Foreground" TargetName="twoLineLabel" Value="{DynamicResource Fluent.Ribbon.Brushes.ExtremeHighlightBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:GalleryItem}" x:Key="GalleryItemControlTemplate">
    <Grid Background="Transparent">
      <Border x:Name="hoverBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.MouseOver}" />
      <Border x:Name="selectedBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.Selected}" />
      <Border x:Name="pressedBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.GalleryItem.Pressed}" />
      <ContentPresenter x:Name="contentPresenter" Margin="1" Opacity="1" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <Trigger Property="IsSelected" Value="True">
        <Setter Property="Visibility" TargetName="selectedBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Visibility" TargetName="hoverBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="Visibility" TargetName="pressedBorder" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryItemStyle" TargetType="{x:Type Fluent:GalleryItem}">
    <Setter Property="Template" Value="{DynamicResource GalleryItemControlTemplate}" />
  </Style>
  <ControlTemplate TargetType="{x:Type ComboBoxItem}" x:Key="ComboBoxItemTemplate">
    <Grid Background="Transparent">
      <Grid Margin="0 0.5" Background="{TemplateBinding Background}">
        <Border x:Name="ItemBackground" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" IsHitTestVisible="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
        <ContentPresenter x:Name="contentPresenter" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" TextElement.Foreground="{TemplateBinding Foreground}" />
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsSelected" Value="True">
        <Setter TargetName="ItemBackground" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter TargetName="ItemBackground" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
    <Setter Property="Padding" Value="3" />
    <Setter Property="Template" Value="{DynamicResource ComboBoxItemTemplate}" />
  </Style>
  <ControlTemplate x:Key="InRibbonGalleryToggleButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="1" Background="Transparent" BorderBrush="Transparent" Height="Auto" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
      <Grid Height="Auto">
        <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Vertical">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="2" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="2,-2,2,2" HasGlyph="True" />
        </StackPanel>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,2,0,2" />
        <Setter Property="Margin" TargetName="controlLabel" Value="-2,0,2,2" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,-2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="border" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="1,2,2,2" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Top" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsChecked" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="InRibbonGalleryButton" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:ToggleButton}">
          <Border BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" BorderThickness="1,1,1,1" x:Name="border" Background="{DynamicResource WhiteBrush}">
            <Grid x:Name="grid">
              <Path Margin="0,6,0,0" VerticalAlignment="Top" Height="1" Fill="{DynamicResource WhiteBrush}" Stretch="Fill" Stroke="{DynamicResource BlackBrush}" Data="M0,0L1,0" HorizontalAlignment="Center" Width="7" />
              <Path Margin="0,8,0,0" VerticalAlignment="Top" Height="3" Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{DynamicResource BlackBrush}" Data="M0,0L1,1 2,0z" Width="5" HorizontalAlignment="Center" StrokeThickness="0" />
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" TargetName="grid" Value="0.5" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InRibbonGalleryRepeatButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" BorderThickness="1" x:Name="border" Background="{DynamicResource WhiteBrush}">
            <ContentPresenter x:Name="contentPresenter" />
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
              <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="BackstageTabItemControlTemplate" TargetType="{x:Type Fluent:BackstageTabItem}">
    <Grid x:Name="rootGrid" Background="Transparent">
      <Border x:Name="selectedBorder" Margin="0" Visibility="Collapsed" Background="{TemplateBinding Fluent:RibbonProperties.IsSelectedBackground}" />
      <Border x:Name="hoverBorder" Margin="0,0,0,0" Visibility="Collapsed" Background="{TemplateBinding Fluent:RibbonProperties.MouseOverBackground}" />
      <StackPanel Orientation="Horizontal" Margin="25,0,15,0" HorizontalAlignment="Left" VerticalAlignment="Center">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Margin="0 0 8 0" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" SnapsToDevicePixels="True" />
        <ContentControl x:Name="PART_Header" Focusable="False" Foreground="{DynamicResource Fluent.Ribbon.Brushes.BackstageTabItem.Header.Foreground}" Content="{TemplateBinding Header}">
          <ContentControl.Resources>
            <Style TargetType="TextBlock">
              <Setter Property="TextWrapping" Value="NoWrap" />
              <Setter Property="TextTrimming" Value="CharacterEllipsis" />
            </Style>
          </ContentControl.Resources>
        </ContentControl>
      </StackPanel>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="hoverBorder" Property="Visibility" Value="Hidden" />
        <Setter TargetName="PART_Header" Property="Opacity" Value="0.5" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Selector.IsSelected" Value="True">
        <Setter TargetName="selectedBorder" Property="Visibility" Value="Visible" />
      </Trigger>
      <Trigger Property="IsKeyboardFocused" Value="True">
        <Setter TargetName="hoverBorder" Property="Visibility" Value="Visible" />
      </Trigger>
      <Trigger Property="IsMouseOver" SourceName="rootGrid" Value="True">
        <Setter TargetName="hoverBorder" Property="Visibility" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="BackstageTabItemStyle" TargetType="{x:Type Fluent:BackstageTabItem}">
    <Setter Property="Template" Value="{DynamicResource BackstageTabItemControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Height" Value="38" />
    <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:BackstageTabControl}}}" />
    <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
    <Setter Property="Fluent:RibbonProperties.MouseOverBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.BackstageTabItem.MouseOver.Background}" />
    <Setter Property="Fluent:RibbonProperties.IsSelectedBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.BackstageTabItem.Selected.Background}" />
    <Setter Property="Margin" Value="0" />
  </Style>
  <Style TargetType="{x:Type Fluent:Button}" x:Key="Fluent.Ribbon.Styles.Backstage.Button">
    <Setter Property="Size" Value="Large" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush6}" />
    <Setter Property="Padding" Value="0 9 0 0" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <Style TargetType="{x:Type Fluent:ToggleButton}" x:Key="Fluent.Ribbon.Styles.Backstage.ToggleButton">
    <Setter Property="Size" Value="Large" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush6}" />
    <Setter Property="Padding" Value="0 9 0 0" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <Style TargetType="{x:Type Fluent:DropDownButton}" x:Key="Fluent.Ribbon.Styles.Backstage.DropDownButton">
    <Setter Property="Size" Value="Large" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="BorderBrush" Value="{DynamicResource GrayBrush6}" />
    <Setter Property="Padding" Value="0 9 0 0" />
    <Setter Property="Height" Value="81" />
    <Setter Property="Width" Value="85" />
  </Style>
  <Style TargetType="{x:Type Fluent:SeparatorTabItem}" x:Key="InnerBackstageSeparatorTabItemStyle">
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:SeparatorTabItem}">
          <Grid Margin="0,0,10,0">
            <TextBlock Margin="0,5" TextWrapping="Wrap" Text="{TemplateBinding Header}" VerticalAlignment="Center" FontSize="17" FontFamily="Segoe UI Light, Lucida Sans Unicode, Verdana" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InnerBackstageTabControlItem" TargetType="{x:Type TabItem}">
    <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabItem}">
          <Grid Background="Transparent" Margin="0,3">
            <Border x:Name="border" BorderBrush="Transparent" BorderThickness="1" Margin="0" Background="Transparent">
              <ContentPresenter Margin="5,5,50,5" ContentSource="Header" />
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="Selector.IsSelected" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
            </Trigger>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="Selector.IsSelected" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
            </MultiTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="InnerBackstageTabControlStyle" TargetType="{x:Type TabControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TabControl}">
          <ControlTemplate.Resources>
            <Style TargetType="{x:Type Fluent:SeparatorTabItem}" BasedOn="{StaticResource InnerBackstageSeparatorTabItemStyle}" />
            <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource InnerBackstageTabControlItem}" />
          </ControlTemplate.Resources>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Border BorderThickness="0,0,1,0" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Stretch" BorderBrush="{DynamicResource GrayBrush7}" />
            <StackPanel Grid.Column="0" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" IsItemsHost="True" />
            <ContentPresenter x:Name="PART_SelectedContentHost" Grid.Column="1" Margin="0" VerticalAlignment="Stretch" ContentSource="SelectedContent" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="Fluent.Ribbon.Styles.BackstageTabControl.Button" TargetType="{x:Type Fluent:Button}">
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Height" Value="38" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.Templates.BackstageTabControl.Button}" />
    <Setter Property="Fluent:RibbonProperties.MouseOverBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.BackstageTabItem.MouseOver.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.IdealForegroundColorBrush}" />
  </Style>
  <Style x:Key="BackstageBackButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Height" Value="48" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Template" Value="{DynamicResource BackstageBackButtonTemplate}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Backstage.BackButton.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.Backstage.BackButton.Foreground}" />
  </Style>
  <Style TargetType="{x:Type Fluent:SeparatorTabItem}" x:Key="Fluent.Ribbon.Styles.BackstageTabControl.SeparatorTabItem">
    <Setter Property="Margin" Value="25,10,20,10" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:SeparatorTabItem}">
          <StackPanel>
            <TextBlock x:Name="header" Margin="10,5" TextWrapping="Wrap" Text="{TemplateBinding Header}" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="{DynamicResource Fluent.Ribbon.Brushes.IdealForegroundColorBrush}" Visibility="Visible" />
            <Line MinWidth="75" Height="1" X2="1" Stroke="{DynamicResource HighTransparentWhiteBrush}" Stretch="Uniform" />
          </StackPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="HasHeader" Value="False">
              <Setter TargetName="header" Property="Visibility" Value="Collapsed" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonStartScreenStyle" TargetType="{x:Type Fluent:StartScreen}" BasedOn="{StaticResource RibbonBackstageStyle}">
    <Setter Property="Template" Value="{x:Null}" />
    <Setter Property="HideContextTabsOnOpen" Value="True" />
    <Setter Property="AreAnimationsEnabled" Value="False" />
    <Setter Property="Fluent:KeyTip.Keys" Value="{x:Null}" />
  </Style>
  <Style x:Key="RibbonSeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Margin" Value="4,0,4,0" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
          <Rectangle Width="1" VerticalAlignment="Stretch" Stroke="{DynamicResource Fluent.Ribbon.Brushes.GroupSeparator.Background}" StrokeThickness="1" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonToolBarStyle" TargetType="{x:Type Fluent:RibbonToolBar}">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="SeparatorStyle">
      <Setter.Value>
        <Style TargetType="{x:Type Separator}" BasedOn="{StaticResource RibbonSeparatorStyle}">
          <Setter Property="Margin" Value="4" />
        </Style>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="RibbonToolBarControlGroupTemplate" TargetType="{x:Type Fluent:RibbonToolBarControlGroup}">
    <StackPanel Orientation="Horizontal">
      <Separator x:Name="separatorLeft" Visibility="Collapsed" Style="{DynamicResource RibbonSeparatorStyle}" />
      <StackPanel Orientation="Horizontal" IsItemsHost="true" />
      <Separator x:Name="separatorRight" Visibility="Collapsed" Style="{DynamicResource RibbonSeparatorStyle}" />
    </StackPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="IsLastInRow" Value="False">
        <Setter Property="Visibility" TargetName="separatorRight" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="{x:Type Fluent:StatusBar}" TargetType="{x:Type Fluent:StatusBar}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Height" Value="Auto" />
    <Setter Property="MinHeight" Value="23" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:StatusBar}">
          <ControlTemplate.Resources>
            <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}">
                    <Border Width="10" Background="Transparent" BorderBrush="Transparent" />
                  </ControlTemplate>
                </Setter.Value>
              </Setter>
            </Style>
          </ControlTemplate.Resources>
          <Border Height="Auto" BorderThickness="0" Background="{TemplateBinding Background}">
            <ItemsPresenter x:Name="itemsPresenter" Height="Auto" />
          </Border>
          <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding ResizeMode, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Value="CanResizeWithGrip">
              <Setter Property="Margin" TargetName="itemsPresenter" Value="0,0,16,0" />
            </DataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <Fluent:StatusBarPanel IsItemsHost="True" Height="Auto" Margin="0" VerticalAlignment="Stretch" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="RibbonStatusBarItemStyle" TargetType="{x:Type Fluent:StatusBarItem}">
    <Setter Property="VerticalAlignment" Value="Center" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.IdealForegroundColorBrush}" />
    <Setter Property="Margin" Value="0 0 2 0" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:StatusBarItem}">
          <ContentPresenter Margin="{TemplateBinding Padding}" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.IdealForegroundDisabledBrush}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" BorderThickness="1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.BorderBrush}" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.Background}">
            <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" />
          </Border>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.BorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Background}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="Transparent" />
              <Setter Property="BorderBrush" TargetName="Border" Value="Transparent" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" BorderThickness="1" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.BorderBrush}" />
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="VerticalScrollBarLineButton" TargetType="{x:Type RepeatButton}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type RepeatButton}">
          <Border Name="Border" Margin="0" BorderThickness="1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.BorderBrush}" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollButton.Default.Background}">
            <Path x:Name="path" Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" />
          </Border>
          <ControlTemplate.Triggers>
            <MultiTrigger>
              <MultiTrigger.Conditions>
                <Condition Property="IsMouseOver" Value="True" />
                <Condition Property="IsPressed" Value="False" />
              </MultiTrigger.Conditions>
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
            </MultiTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
              <Setter Property="Background" TargetName="Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter Property="Opacity" TargetName="path" Value="0.5" />
              <Setter Property="Background" TargetName="Border" Value="Transparent" />
              <Setter Property="BorderBrush" TargetName="Border" Value="Transparent" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <Style x:Key="VerticalScrollBarThumb" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Thumb}">
          <Border x:Name="border" BorderThickness="1" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ScrollThumb.Default.BorderBrush}" />
          <ControlTemplate.Triggers>
            <Trigger Property="IsDragging" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
              <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition MaxHeight="18" />
        <RowDefinition Height="0.00001*" />
        <RowDefinition MaxHeight="18" />
      </Grid.RowDefinitions>
      <Border Grid.RowSpan="3" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollBar.Background}" />
      <RepeatButton x:Name="repeatButton" Grid.Row="0" Style="{DynamicResource VerticalScrollBarLineButton}" Height="17" Command="ScrollBar.LineUpCommand" Content="M 0 4 L 8 4 L 4 0 Z" VerticalAlignment="Top" Margin="1,1,1,0" Background="{DynamicResource WhiteBrush}" />
      <Track Name="PART_Track" Grid.Row="1" IsDirectionReversed="true" ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <System:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
                        36
                    </System:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{DynamicResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{DynamicResource VerticalScrollBarThumb}" Margin="1,0,1,0" RenderTransformOrigin="0.5,0.5" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{DynamicResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Row="3" Style="{DynamicResource VerticalScrollBarLineButton}" Height="17" Command="ScrollBar.LineDownCommand" Content="M 0 0 L 4 4 L 8 0 Z" Margin="1,0,1,1" Background="{DynamicResource WhiteBrush}" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition MaxWidth="18" />
        <ColumnDefinition Width="0.00001*" />
        <ColumnDefinition MaxWidth="18" />
      </Grid.ColumnDefinitions>
      <Border Grid.ColumnSpan="3" Margin="0" Background="{DynamicResource Fluent.Ribbon.Brushes.ScrollBar.Background}" />
      <RepeatButton x:Name="repeatButton" Grid.Column="0" Style="{DynamicResource ScrollBarLineButton}" Width="17" Command="ScrollBar.LineLeftCommand" Content="M 4 0 L 4 8 L 0 4 Z" Margin="1,1,0,1" Background="{DynamicResource WhiteBrush}" />
      <Track Name="PART_Track" Grid.Column="1" IsDirectionReversed="False" Margin="0,1,0,1" ViewportSize="{TemplateBinding ViewportSize}">
        <Track.Resources>
          <!-- Set the Thumb's minimum height to 50.
                      The Thumb's minimum height is half the
                      value of VerticalScrollBarButtonHeightKey. -->
          <System:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
                        36
                    </System:Double>
        </Track.Resources>
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{DynamicResource ScrollBarPageButton}" Command="ScrollBar.PageLeftCommand" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb Style="{DynamicResource ScrollBarThumb}" Margin="0,0,0,0" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{DynamicResource ScrollBarPageButton}" Command="ScrollBar.PageRightCommand" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton1" Grid.Column="3" Style="{DynamicResource ScrollBarLineButton}" Width="17" Command="ScrollBar.LineRightCommand" Content="M 0 0 L 4 4 L 0 8 Z" Margin="0,1,1,1" Background="{DynamicResource WhiteBrush}" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="repeatButton" Value="{x:Null}" />
        <Setter Property="Background" TargetName="repeatButton1" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="ScrollBar">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template" Value="{DynamicResource HorizontalScrollBar}" />
        <Setter Property="Height" Value="17" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{DynamicResource VerticalScrollBar}" />
        <Setter Property="Width" Value="17" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style TargetType="ScrollBar" x:Key="ScrollBarWhite">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
    <Style.Triggers>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="Width" Value="Auto" />
        <Setter Property="Template" Value="{DynamicResource HorizontalScrollBar}" />
        <Setter Property="Height" Value="17" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Template" Value="{DynamicResource VerticalScrollBar}" />
        <Setter Property="Width" Value="17" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:TextBox}" x:Key="Fluent.Ribbon.ControlTemplates.TextBox">
    <Grid Width="Auto" Height="22" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="PART_HeaderAndIconPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
        <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition SharedSizeGroup="{Binding Path=(Fluent:RibbonGroupBoxWrapPanel.SharedSizeGroupName), RelativeSource={RelativeSource TemplatedParent}}" />
          </Grid.ColumnDefinitions>
          <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="headerTextBlock" />
        </Grid>
      </StackPanel>
      <Border Height="Auto" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.BorderBrush}" x:Name="PART_ContentBorder" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" HorizontalAlignment="Right">
        <ScrollViewer Margin="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" x:Name="PART_ContentHost" />
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputWidth" Value="NaN">
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Visibility" TargetName="headerTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="PART_HeaderAndIconPanel" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.BorderBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_ContentHost" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="headerTextBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ContentHost" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ContentHost" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:TextBox}" BasedOn="{StaticResource {x:Type TextBoxBase}}">
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.ControlTemplates.TextBox}" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="CaretBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.CaretBrush}" />
    <Setter Property="SelectionBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.SelectionBrush}" />
  </Style>
  <ControlTemplate x:Key="SpinnerButtonControlTemplate" TargetType="{x:Type RepeatButton}">
    <Border x:Name="border" BorderThickness="1" Background="Transparent" BorderBrush="Transparent" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="False" />
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="SpinnerButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{DynamicResource SpinnerButtonControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:Spinner}" x:Key="Fluent.Ribbon.ControlTemplates.Spinner">
    <Grid Width="Auto" Height="22" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="headerAndIconPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
        <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="4,0,0,0" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition SharedSizeGroup="{Binding Path=(Fluent:RibbonGroupBoxWrapPanel.SharedSizeGroupName), RelativeSource={RelativeSource TemplatedParent}}" />
          </Grid.ColumnDefinitions>
          <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="headerTextBlock" />
        </Grid>
      </StackPanel>
      <Border x:Name="PART_ContentBorder" Height="22" BorderThickness="1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.BorderBrush}" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Grid.ColumnSpan="1" Grid.Column="1" Width="{TemplateBinding InputWidth}" HorizontalAlignment="Right">
        <Grid Grid.ColumnSpan="1" Grid.Column="1">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="17" />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
          </Grid.RowDefinitions>
          <TextBox x:Name="PART_TextBox" Style="{x:Null}" BorderThickness="0" Grid.RowSpan="2" Grid.Column="0" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Foreground="{TemplateBinding Foreground}" CaretBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.CaretBrush}" SelectionBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.SelectionBrush}" Padding="2,0,2,0" Margin="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
          <Path Visibility="Collapsed" HorizontalAlignment="Left" Margin="0,-1,0,-1" x:Name="path" Width="1" Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" StrokeThickness="1" Grid.Column="1" Grid.RowSpan="2" Data="M0,0L0,1" />
          <Path HorizontalAlignment="Left" Margin="0,0,-1,0" Width="Auto" Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" StrokeThickness="1" Data="M0,0L1,0" Visibility="Collapsed" x:Name="path1" VerticalAlignment="Bottom" Height="1" Grid.Column="1" Grid.RowSpan="1" />
          <RepeatButton x:Name="PART_ButtonUp" Grid.Column="1" Grid.Row="0" Style="{DynamicResource SpinnerButtonStyle}" RenderTransformOrigin="0,0.5" HorizontalAlignment="Stretch">
            <Path Width="5" Height="3" Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{DynamicResource BlackBrush}" Data="M0,0L1,-1 2,0" HorizontalAlignment="Center" StrokeThickness="0" VerticalAlignment="Center" Margin="1,2,0,1" RenderOptions.EdgeMode="Aliased" />
          </RepeatButton>
          <RepeatButton x:Name="PART_ButtonDown" Grid.Column="1" Grid.Row="1" Style="{DynamicResource SpinnerButtonStyle}">
            <Path Width="5" Height="3" Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{DynamicResource BlackBrush}" Data="M0,0L1,1 2,0" StrokeThickness="0" HorizontalAlignment="Center" Margin="1,-1,0,0" VerticalAlignment="Center" RenderOptions.EdgeMode="Aliased" />
          </RepeatButton>
        </Grid>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputWidth" Value="NaN">
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_TextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="headerTextBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Visibility" TargetName="headerTextBlock" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="headerAndIconPanel" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Visibility" TargetName="path" Value="Visible" />
        <Setter Property="Visibility" TargetName="path1" Value="Visible" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
        <Setter Property="Background" TargetName="PART_TextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="SpinnerStyle" TargetType="{x:Type Fluent:Spinner}">
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.ControlTemplates.Spinner}" />
  </Style>
  <ControlTemplate x:Key="RibbonComboButtonControlTemplate" TargetType="{x:Type Fluent:ToggleButton}">
    <Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" Background="{DynamicResource WhiteBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" Height="Auto" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
      <Grid Height="Auto" HorizontalAlignment="Right">
        <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed" Fill="{DynamicResource WhiteBrush}" />
        <Path x:Name="path" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M0,0L1,1 2,0z" Fill="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" Margin="3,0,3,0" Stretch="Fill" Width="5" Height="3" IsHitTestVisible="False" />
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsPressed" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="path" Value="0.5" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsPressed" Value="False" />
          <Condition Property="IsChecked" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.ColorGallery.ListBox.ItemContainerStyle" TargetType="{x:Type ListBoxItem}">
    <Setter Property="Padding" Value="{Binding Padding, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}, FallbackValue='2,0,2,0'}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListBoxItem}">
          <Grid Background="Transparent">
            <ContentPresenter Margin="{TemplateBinding Padding}" Width="{Binding ChipWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" Height="{Binding ChipHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ColorGallery}}, FallbackValue=13}" />
            <Border x:Name="outerBorder" BorderThickness="1" Margin="{TemplateBinding Padding}">
              <Border x:Name="innerBorder" BorderThickness="1" />
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
              <Setter Property="BorderBrush" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.DarkExtremeHighlightBrush}" />
              <Setter Property="BorderBrush" TargetName="innerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.DarkExtremeHighlightBrush}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="BorderBrush" TargetName="outerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.DarkExtremeHighlightBrush}" />
              <Setter Property="BorderBrush" TargetName="innerBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ExtremeHighlightBrush}" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Content">
        <Trigger.Value>
          <Color />
        </Trigger.Value>
        <Setter Property="Opacity" Value="0" />
        <Setter Property="IsHitTestVisible" Value="False" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <DataTemplate x:Key="Fluent.Ribbon.ColorGallery.ListBox.ItemTemplate">
    <Rectangle Stroke="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" Fill="{Binding Converter={x:Static converters:StaticConverters.ColorToSolidColorBrushValueConverter}}" />
  </DataTemplate>
  <Style x:Key="ColorGalleryListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Background}" />
    <Setter Property="ItemTemplate" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.ItemTemplate}" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.Template.Row1}" />
    <Setter Property="ItemContainerStyle" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.ItemContainerStyle}" />
  </Style>
  <Style x:Key="HightlightColorGalleryListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Background}" />
    <Setter Property="ItemTemplate" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.ItemTemplate}" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.Template.Row0}" />
    <Setter Property="ItemContainerStyle" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.ItemContainerStyle}" />
  </Style>
  <DataTemplate x:Key="GradientColorCenterDataTemplate">
    <Border BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" BorderThickness="1,0,1,0" Background="{Binding Converter={x:Static converters:StaticConverters.ColorToSolidColorBrushValueConverter}}" />
  </DataTemplate>
  <DataTemplate x:Key="GradientColorTopDataTemplate">
    <Border BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" BorderThickness="1,1,1,0" Background="{Binding Converter={x:Static converters:StaticConverters.ColorToSolidColorBrushValueConverter}}" />
  </DataTemplate>
  <DataTemplate x:Key="GradientColorBottomDataTemplate">
    <Border BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" BorderThickness="1,0,1,1" Background="{Binding Converter={x:Static converters:StaticConverters.ColorToSolidColorBrushValueConverter}}" />
  </DataTemplate>
  <Style x:Key="ColorGalleryGradientListBox" TargetType="{x:Type ListBox}">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Background}" />
    <Setter Property="ItemTemplateSelector" Value="{DynamicResource ColorGradientItemTemplateSelect}" />
    <Setter Property="Template" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.Template.Row0}" />
    <Setter Property="ItemContainerStyle" Value="{DynamicResource Fluent.Ribbon.ColorGallery.ListBox.ItemContainerStyle}" />
  </Style>
  <Style TargetType="{x:Type Fluent:ColorGallery}">
    <Setter Property="ChipWidth" Value="13" />
    <Setter Property="ChipHeight" Value="13" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:ColorGallery}">
          <StackPanel KeyboardNavigation.DirectionalNavigation="Contained">
            <Fluent:MenuItem x:Name="PART_AutomaticColor" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.Automatic, Mode=OneWay}">
              <Fluent:MenuItem.Icon>
                <Rectangle Width="16" Height="16" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" Fill="{DynamicResource BlackBrush}" Margin="-2,0,0,0" />
              </Fluent:MenuItem.Icon>
            </Fluent:MenuItem>
            <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
              <StackPanel Background="{TemplateBinding Background}" ClipToBounds="True" Margin="0,1,0,1" KeyboardNavigation.DirectionalNavigation="Contained">
                <Fluent:GroupSeparatorMenuItem Header="Theme Colors" x:Name="themeColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_ThemeColorsListBox" ItemsSource="{Binding ThemeColors, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource ColorGalleryListBox}" Padding="2" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_ThemeGradientColorsListBox" ItemsSource="{Binding ThemeGradients, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource ColorGalleryGradientListBox}" Padding="2,0,2,0" />
                <Fluent:GroupSeparatorMenuItem Header="Standard Colors" x:Name="standardColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_StandardColorsListBox" ItemsSource="{x:Static Fluent:ColorGallery.StandardThemeColors}" Style="{DynamicResource ColorGalleryListBox}" Padding="2" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_StandardGradientColorsListBox" ItemsSource="{Binding StandardGradients, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource ColorGalleryGradientListBox}" Padding="2,0,2,0" />
                <Fluent:GroupSeparatorMenuItem Header="Recent Colors" x:Name="recentColorsSeparator" />
                <ListBox KeyboardNavigation.DirectionalNavigation="Contained" x:Name="PART_RecentColorsListBox" ItemsSource="{x:Static Fluent:ColorGallery.RecentColors}" Style="{DynamicResource ColorGalleryListBox}" Padding="2" />
              </StackPanel>
            </ScrollViewer>
            <Fluent:MenuItem x:Name="PART_NoColor" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.NoColor, Mode=OneWay}">
              <Fluent:MenuItem.Icon>
                <Rectangle Width="16" Height="16" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ColorGallery.Item.BorderBrush}" Fill="Transparent" Margin="-2,0,0,0" />
              </Fluent:MenuItem.Icon>
            </Fluent:MenuItem>
            <Separator x:Name="separator">
              <Separator.Template>
                <ControlTemplate>
                  <Rectangle Width="Auto" Height="1" Fill="{DynamicResource Fluent.Ribbon.Brushes.Separator.Background}" />
                </ControlTemplate>
              </Separator.Template>
            </Separator>
            <Fluent:MenuItem x:Name="PART_MoreColors" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.MoreColors, Mode=OneWay}" Icon="{DynamicResource Fluent.Ribbon.Images.MoreColors}" />
          </StackPanel>
          <ControlTemplate.Triggers>
            <Trigger Property="IsAutomaticColorButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_AutomaticColor" />
            </Trigger>
            <Trigger Property="IsNoColorButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_NoColor" />
            </Trigger>
            <Trigger Property="IsMoreColorsButtonVisible" Value="False">
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_MoreColors" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="separator" />
            </Trigger>
            <Trigger Property="Mode" Value="HighlightColors">
              <Setter Property="ChipWidth" Value="26" />
              <Setter Property="ChipHeight" Value="26" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="standardColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RecentColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_StandardGradientColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeGradientColorsListBox" />
              <Setter Property="Columns" Value="5" />
              <Setter Property="Style" Value="{DynamicResource HightlightColorGalleryListBox}" TargetName="PART_StandardColorsListBox" />
              <Setter Property="ItemsSource" Value="{x:Static Fluent:ColorGallery.HighlightColors}" TargetName="PART_StandardColorsListBox" />
            </Trigger>
            <Trigger Property="Mode" Value="StandardColors">
              <Setter Property="ChipWidth" Value="20" />
              <Setter Property="ChipHeight" Value="20" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="standardColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_RecentColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_StandardColorsListBox" />
              <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ThemeGradientColorsListBox" />
              <Setter Property="Columns" Value="5" />
              <Setter Property="StandardColorGridRows" Value="6" />
              <Setter Property="ItemsSource" Value="{x:Static Fluent:ColorGallery.StandardColors}" TargetName="PART_StandardGradientColorsListBox" />
            </Trigger>
            <DataTrigger Binding="{Binding ThemeColors.Count, RelativeSource={RelativeSource Self}}" Value="0">
              <Setter Property="Visibility" Value="Collapsed" TargetName="themeColorsSeparator" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Count, Source={x:Static Fluent:ColorGallery.RecentColors}}" Value="0">
              <Setter Property="Visibility" Value="Collapsed" TargetName="recentColorsSeparator" />
            </DataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Thumb}" x:Key="SliderThumbControlTemplate">
    <Grid Margin="2.5,0.5">
      <Border Name="path" Background="{TemplateBinding Foreground}" Width="3" Height="11">
        <Border Name="hoverborder" />
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="Background" TargetName="hoverborder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="IsDragging" Value="True">
        <Setter Property="Background" TargetName="hoverborder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Width" Value="16" />
    <Setter Property="Height" Value="16" />
    <Setter Property="Foreground" Value="{DynamicResource WhiteBrush}" />
    <Setter Property="Template" Value="{DynamicResource SliderRepeatButtonControlTemplate}" />
  </Style>
  <DrawingImage x:Key="Fluent.Ribbon.Images.Checked" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Geometry="F1 M 65.1237,26.8028L 38.0797,58.5308L 20.2091,43.5268">
            <GeometryDrawing.Pen>
              <Pen Thickness="6.66667" MiterLimit="2.75" Brush="{DynamicResource BlackBrush}" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.QuickAccessToolbarDropDown" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.QuickAccessToolbarDropDown}" Geometry="F1 M 5.33333,13.3333L 80.0013,13.3333L 80.0013,0L 5.33333,0M 12.6667,28L 42.6667,64L 72.6667,28L 12.6667,28 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.QuickAccessToolbarDropDown.BelowRibbon" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.QuickAccessToolbarDropDown.BelowRibbon}" Geometry="F1 M 5.33333,13.3333L 80.0013,13.3333L 80.0013,0L 5.33333,0M 12.6667,28L 42.6667,64L 72.6667,28L 12.6667,28 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.QuickAccessToolbarExtender" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.QuickAccessToolbarExtender}" Geometry="F1 M 48,14L 48,71.3333L 80,42.6667M 5.33333,14L 37.3333,42.6667L 5.33333,71.3333L 5.33333,14 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.QuickAccessToolbarExtender.BelowRibbon" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.QuickAccessToolbarExtender.BelowRibbon}" Geometry="F1 M 48,14L 48,71.3333L 80,42.6667M 5.33333,14L 37.3333,42.6667L 5.33333,71.3333L 5.33333,14 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.RibbonCollapse" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 6.50001,85.3333L 91.8333,85.3333L 91.8333,0L 6.50001,0L 6.50001,85.3333 Z " />
          <GeometryDrawing Geometry="F1 M 76.9987,56.5833L 49.1667,28.75L 21.3333,56.5833">
            <GeometryDrawing.Pen>
              <Pen Thickness="10.6667" MiterLimit="2.75" Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.RibbonCollapse}" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.RibbonExpand" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 6.50001,85.3333L 91.8333,85.3333L 91.8333,0L 6.50001,0L 6.50001,85.3333 Z " />
          <GeometryDrawing Geometry="F1 M 76.9987,28.7507L 49.1667,56.584L 21.3333,28.7507">
            <GeometryDrawing.Pen>
              <Pen Thickness="10.6667" MiterLimit="2.75" Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.RibbonExpand}" />
            </GeometryDrawing.Pen>
          </GeometryDrawing>
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <DrawingImage x:Key="Fluent.Ribbon.Images.RibbonPin" x:Shared="False">
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing Brush="#00FFFFFF" Geometry="F1 M 0,85.3333L 85.3333,85.3333L 85.3333,0L 0,0L 0,85.3333 Z " />
          <GeometryDrawing Brush="{DynamicResource Fluent.Ribbon.Brushes.Images.RibbonPin}" Geometry="F1 M 46.176,42.6667L 33.8947,42.6667L 33.8947,16.3507L 46.176,16.3507M 60.0733,42.6667L 57.58,42.6667L 57.58,13.8693C 57.58,11.364 55.548,9.33334 53.0427,9.33334L 32.2907,9.33334C 29.7853,9.33334 27.7547,11.364 27.7547,13.8693L 27.7547,42.6667L 25.2613,42.6667C 22.7627,42.6667 20.7373,44.6933 20.7373,47.192L 20.7373,48.6693C 20.7373,51.168 22.7627,53.1933 25.2613,53.1933L 37.404,53.1933L 37.404,70.7373C 37.404,73.6427 39.76,76 42.6667,76C 45.5733,76 47.9293,73.6427 47.9293,70.7373L 47.9293,53.1933L 60.0733,53.1933C 62.572,53.1933 64.596,51.168 64.596,48.6693L 64.596,47.192C 64.596,44.6933 62.572,42.6667 60.0733,42.6667 Z " />
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
  </DrawingImage>
  <Style x:Key="RibbonWindowStyle" TargetType="{x:Type Fluent:RibbonWindow}">
    <Setter Property="BorderBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" />
    <Setter Property="NonActiveBorderBrush" Value="#434346" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="GlowBrush" Value="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" />
    <Setter Property="NonActiveGlowBrush" Value="#434346" />
    <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
    <Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
    <Setter Property="TitleBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonWindow.TitleBackground}" />
    <Setter Property="TitleForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonWindow.TitleForeground}" />
    <Setter Property="Template" Value="{StaticResource RibbonWindowControlTemplate}" />
    <Setter Property="TitleBarHeight" Value="{DynamicResource {x:Static SystemParameters.WindowCaptionHeightKey}}" />
  </Style>
  <Style TargetType="{x:Type Fluent:Spinner}" BasedOn="{StaticResource SpinnerStyle}" />
  <Style TargetType="{x:Type Fluent:TwoLineLabel}" BasedOn="{StaticResource TwoLineLabelStyle}" />
  <Style TargetType="{x:Type Fluent:KeyTip}" BasedOn="{StaticResource KeyTipStyle}" />
  <Style TargetType="{x:Type Fluent:ScreenTip}" BasedOn="{StaticResource ScreenTipStyle}" />
  <Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource ToolTipStyle}" />
  <Style TargetType="{x:Type Fluent:GalleryGroupContainer}" BasedOn="{StaticResource GalleryGroupContainerStyle}" />
  <Style TargetType="{x:Type Fluent:SeparatorTabItem}" BasedOn="{StaticResource SeparatorTabItemStyle}" />
  <Style TargetType="{x:Type Fluent:Backstage}" BasedOn="{StaticResource RibbonBackstageStyle}" />
  <Style TargetType="{x:Type Fluent:BackstageTabItem}" BasedOn="{StaticResource BackstageTabItemStyle}" />
  <Style TargetType="{x:Type Fluent:StartScreen}" BasedOn="{StaticResource RibbonStartScreenStyle}" />
  <Style TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource RibbonButtonStyle}" />
  <Style TargetType="{x:Type Fluent:CheckBox}" BasedOn="{StaticResource RibbonCheckBoxStyle}" />
  <Style TargetType="{x:Type Fluent:GalleryItem}" BasedOn="{StaticResource GalleryItemStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonTabItem}" BasedOn="{StaticResource RibbonTabItemStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonToolBar}" BasedOn="{StaticResource RibbonToolBarStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonWindow}" BasedOn="{StaticResource RibbonWindowStyle}" />
  <Style TargetType="{x:Type Fluent:StatusBarItem}" BasedOn="{StaticResource RibbonStatusBarItemStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonTitleBar}" BasedOn="{StaticResource RibbonTitleBarStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonGroupsContainerScrollViewer}" BasedOn="{StaticResource Fluent.Ribbon.Styles.RibbonGroupsContainerScrollViewer}" />
  <ControlTemplate x:Key="RibbonTabControlControlTemplate" TargetType="{x:Type Fluent:RibbonTabControl}">
    <ControlTemplate.Resources>
      <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ScrollViewer}">
              <Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">
                <ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
                <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}">
                  <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                    </MultiBinding>
                  </RepeatButton.Visibility>
                  <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z" />
                </RepeatButton>
                <RepeatButton Command="{x:Static ScrollBar.LineRightCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{DynamicResource ScrollButtonStyle}">
                  <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ComputedHorizontalScrollBarVisibility" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="HorizontalOffset" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ExtentWidth" />
                      <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ViewportWidth" />
                    </MultiBinding>
                  </RepeatButton.Visibility>
                  <Path Fill="{DynamicResource BlackBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z" />
                </RepeatButton>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
        <Setter Property="CanContentScroll" Value="True" />
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
        <Setter Property="PanningMode" Value="HorizontalOnly" />
      </Style>
    </ControlTemplate.Resources>
    <Grid x:Name="ContentGrid" Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local" Height="Auto" VerticalAlignment="Top">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition x:Name="rowDefinition" MinHeight="{TemplateBinding ContentHeight}" MaxHeight="{TemplateBinding ContentHeight}" />
        <RowDefinition x:Name="rowDefinition1" MinHeight="{TemplateBinding ContentGapHeight}" MaxHeight="{TemplateBinding ContentGapHeight}" />
      </Grid.RowDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0,-1,0,0" Width="Auto" BorderThickness="0,1" Grid.Row="1" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
      <Border HorizontalAlignment="Stretch" Grid.Row="1" Grid.RowSpan="1" Background="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Content.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Content.BorderBrush}" BorderThickness="{DynamicResource Fluent.Ribbon.Values.RibbonTabControl.Content.BorderThickness}" TextElement.Foreground="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Content.Foreground}" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2">
        <ContentControl x:Name="mainContentControl" Margin="0" Focusable="False">
          <ContentPresenter ContentSource="SelectedContent" x:Name="PART_SelectedContentPresenter" HorizontalAlignment="Stretch" Margin="0" />
        </ContentControl>
      </Border>
      <Border Margin="0" VerticalAlignment="Stretch" Grid.Row="2" Background="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
      <Grid x:Name="TabsGrid" Background="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.TabsGrid.Background}" TextElement.Foreground="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.TabsGrid.Foreground}" HorizontalAlignment="Stretch" Width="Auto" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Fluent:WindowSteeringHelperControl Grid.ColumnSpan="4" />
        <!-- Margin on bottom is need to keep the border surrounding the content area visible below the menu presenter -->
        <ContentPresenter Grid.Column="0" VerticalAlignment="Stretch" ContentSource="Menu" Margin="0 0 0 1" />
        <Fluent:RibbonScrollViewer Grid.Column="1" Visibility="{Binding AreTabHeadersVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolToVisibilityConverter}}" HorizontalAlignment="Left" Margin="0" Width="Auto" Style="{DynamicResource RibbonTabScrollViewer}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" IsHitTestVisible="True" IsTabStop="False">
          <Fluent:RibbonTabsContainer x:Name="PART_TabsContainer" IsItemsHost="True" Height="Auto" HorizontalAlignment="Stretch" Margin="0" KeyboardNavigation.TabIndex="1" />
        </Fluent:RibbonScrollViewer>
        <StackPanel HorizontalAlignment="Right" Grid.Column="3" Orientation="Horizontal" Margin="0,0,0,1">
          <Fluent:ToggleButton x:Name="PART_MinimizeButton" Margin="0" Width="22" Height="22" Size="Small" Style="{DynamicResource RibbonTabControlToggleButtonStyle}" IsChecked="{Binding Path=IsMinimized, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{TemplateBinding CanMinimize, Converter={StaticResource boolToVisibilityConverter}}" />
          <StackPanel x:Name="PART_ToolbarPanel" Visibility="{Binding IsToolBarVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolToVisibilityConverter}}" Orientation="Horizontal" />
        </StackPanel>
      </Grid>
      <!-- Placement target must be the selected item. Otherwise things like DPI and monitor are selected wrong if the tabcontrol 0,0 is on a different screen than the selected tabs 0,0 -->
      <Popup x:Name="PART_Popup" PlacementTarget="{Binding Path=SelectedTabItem, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" Placement="Custom" AllowsTransparency="True" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" IsOpen="{TemplateBinding IsDropDownOpen}">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="{x:Static Fluent:RibbonTabControl.AdditionalPopupSpaceForKeyTipsGridLength}" />
            <!-- Needed for overlapping Keytips -->
            <RowDefinition MinHeight="{TemplateBinding ContentHeight}" MaxHeight="{TemplateBinding ContentHeight}" />
            <RowDefinition Height="{x:Static Fluent:RibbonTabControl.AdditionalPopupSpaceForKeyTipsGridLength}" />
            <!-- Needed for overlapping Keytips -->
          </Grid.RowDefinitions>
          <Border Grid.Row="1" BorderThickness="0,0,0,1" Margin="1,0" BorderBrush="{Binding Path=SelectedItem.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" Background="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Content.Background}" TextElement.Foreground="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Content.Foreground}" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained">
            <ContentControl x:Name="popupContentControl" Focusable="False" Margin="0" />
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMinimized" Value="False">
        <Setter TargetName="PART_MinimizeButton" Property="Icon" Value="{DynamicResource Fluent.Ribbon.Images.RibbonCollapse}" />
        <Setter TargetName="PART_MinimizeButton" Property="ToolTip" Value="{DynamicResource Fluent.Ribbon.Resources.RibbonTabControl.MinimizeScreenTip}" />
      </Trigger>
      <Trigger Property="IsMinimized" Value="True">
        <Setter Property="MinHeight" TargetName="rowDefinition" Value="0" />
        <Setter Property="MinHeight" TargetName="rowDefinition1" Value="0" />
        <!-- Switch content to popup -->
        <Setter Property="Content" TargetName="mainContentControl" Value="{x:Null}" />
        <Setter Property="Content" TargetName="popupContentControl" Value="{Binding ElementName=PART_SelectedContentPresenter, Mode=OneWay}" />
        <!-- Switch content to popup END -->
        <Setter TargetName="PART_MinimizeButton" Property="Icon" Value="{DynamicResource Fluent.Ribbon.Images.RibbonExpand}" />
        <Setter TargetName="PART_MinimizeButton" Property="ToolTip" Value="{DynamicResource Fluent.Ribbon.Resources.RibbonTabControl.ExpandScreenTip}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsDropDownOpen" Value="True" />
          <Condition Property="IsMinimized" Value="True" />
        </MultiTrigger.Conditions>
        <Setter TargetName="PART_MinimizeButton" Property="Icon" Value="{DynamicResource Fluent.Ribbon.Images.RibbonPin}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonGroupBoxDropDownButtonControlTemplate" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <Grid Width="22">
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Stretch">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" Margin="1,1,0,0" SnapsToDevicePixels="True" />
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Width="Auto" Height="Auto" Margin="0,20">
          <Border x:Name="border" Height="Auto" Background="{DynamicResource Fluent.Ribbon.Brushes.Ribbon.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush}" BorderThickness="1" d:LayoutOverrides="Width">
            <Grid x:Name="PART_ParentPanel" Margin="0,1,0,2" Height="85">
              <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Fluent:RibbonGroupBoxWrapPanel x:Name="PART_UpPanel" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsItemsHost="True" Margin="2,0,4,0" />
              <Grid x:Name="PART_DownGrid" Margin="0,-2,2,2" Grid.Row="1" VerticalAlignment="Bottom" Height="Auto" MaxWidth="{Binding ActualWidth, ElementName=PART_UpPanel}">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ContentControl Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2,0" KeyboardNavigation.IsTabStop="False" />
                <Fluent:Button Margin="0,0,1,1" x:Name="PART_DialogLauncherButton" HorizontalAlignment="Stretch" Width="15" Height="14" Grid.Column="1" Focusable="False" IsTabStop="False" Template="{DynamicResource DialogLauncherButtonControlTemplate}" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" Icon="{TemplateBinding LauncherIcon}" Header="{TemplateBinding LauncherText}" Command="{Binding LauncherCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandTarget="{Binding LauncherCommandTarget, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding LauncherCommandParameter, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding LauncherToolTip, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsLauncherEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{DynamicResource RibbonToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="BorderThickness" Value="1" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="InnerButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{DynamicResource InnerButtonControlTemplate}" />
    <Setter Property="VerticalAlignment" Value="Stretch" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Fluent:KeyTip.AutoPlacement" Value="{Binding Path=(Fluent:KeyTip.AutoPlacement), RelativeSource={RelativeSource AncestorType={x:Type Fluent:SplitButton}}}" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Top" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Left" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.Margin" Value="-5,0,0,0" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Left" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.Margin" Value="-5,0,0,0" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="MenuScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template" Value="{StaticResource MenuScrollViewerControlTemplate}" />
    <Setter Property="CanContentScroll" Value="False" />
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <Style x:Key="ScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
    <Style.Resources>
      <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
    </Style.Resources>
    <Setter Property="Template" Value="{DynamicResource ScrollViewerControlTemplate}" />
    <Style.Triggers>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="RibbonContextualTabGroupStyle" TargetType="{x:Type Fluent:RibbonContextualTabGroup}">
    <Setter Property="Template" Value="{DynamicResource RibbonContextualTabGroupControlTemplate}" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="HorizontalAlignment" Value="Stretch" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.Foreground}" />
    <Setter Property="TabItemSelectedForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonContextualTabGroup.TabItemSelectedForeground}" />
    <Setter Property="TabItemMouseOverForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonContextualTabGroup.TabItemMouseOverForeground}" />
    <Setter Property="TabItemSelectedMouseOverForeground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonContextualTabGroup.TabItemSelectedMouseOverForeground}" />
  </Style>
  <ControlTemplate x:Key="ToolbarDropDownButtonControlTemplate" TargetType="{x:Type Fluent:DropDownButton}">
    <Grid>
      <Border x:Name="PART_ButtonBorder" BorderThickness="1" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <ContentPresenter x:Name="iconImage" Width="8" Height="8" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '8,8', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
              <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <StackPanel x:Name="PART_MenuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.25" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuItemTemplate" TargetType="{x:Type MenuItem}">
    <Grid Background="{TemplateBinding Background}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="3" />
      <ContentPresenter x:Name="textBlock" ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Width="Auto" Height="Auto" Margin="5,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="{Binding Path=(Fluent:MenuItem.RecognizesAccessKey), RelativeSource={RelativeSource TemplatedParent}}" />
      <Border x:Name="iconImageBorder" BorderThickness="1">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      </Border>
      <Image x:Name="checkedImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <TextBlock x:Name="gestureTextBlock" Text="{TemplateBinding InputGestureText}" Width="Auto" Height="Auto" Margin="3,3,15,3" VerticalAlignment="Center" Grid.Column="2" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="InputGestureText" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputGestureText" Value="">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Background" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.Background}" />
        <Setter Property="BorderBrush" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.BorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="checkedImage" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="checkedImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Opacity" TargetName="gestureTextBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="checkedImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderMenuItemTemplate" TargetType="{x:Type MenuItem}">
    <Grid Background="{TemplateBinding Background}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="3" />
      <ContentPresenter x:Name="textBlock" ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Width="Auto" Height="Auto" Margin="5,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="{Binding Path=(Fluent:MenuItem.RecognizesAccessKey), RelativeSource={RelativeSource TemplatedParent}}" />
      <Border x:Name="iconImageBorder" BorderThickness="1">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      </Border>
      <Image x:Name="checkedImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Background" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.Background}" />
        <Setter Property="BorderBrush" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.BorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="checkedImage" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="checkedImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="checkedImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedMenuItemTemplate" TargetType="{x:Type MenuItem}">
    <Grid Background="{TemplateBinding Background}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" Margin="0,0,-1,0" />
        <Border x:Name="Submenu_Border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" Grid.Column="1" />
      </Grid>
      <ContentPresenter x:Name="textBlock" ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Width="Auto" Height="Auto" Margin="5,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="{Binding Path=(Fluent:MenuItem.RecognizesAccessKey), RelativeSource={RelativeSource TemplatedParent}}" />
      <Border x:Name="iconImageBorder" BorderThickness="1">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      </Border>
      <Image x:Name="checkedImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Fluent:MenuItem.ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Background" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.Background}" />
        <Setter Property="BorderBrush" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.BorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="checkedImage" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="Submenu_Border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Background" TargetName="Submenu_Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="checkedImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="checkedImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="MenuItemWithDescriptionTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <Grid Background="{TemplateBinding Background}">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="45" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" />
      <ContentControl x:Name="textBlock" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" TextElement.FontWeight="Bold" Width="Auto" Height="Auto" Margin="0,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" />
      <ContentPresenter x:Name="descriptionPresenter" Grid.Row="1" ContentSource="Description" Width="Auto" Height="Auto" Margin="0,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" RecognizesAccessKey="{Binding Path=(Fluent:MenuItem.RecognizesAccessKey), RelativeSource={RelativeSource TemplatedParent}}" />
      <Border x:Name="iconImageBorder" BorderThickness="1">
        <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      </Border>
      <Image x:Name="checkedImage" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <TextBlock x:Name="gestureTextBlock" Text="{TemplateBinding InputGestureText}" Width="Auto" Height="Auto" Margin="3,3,15,3" VerticalAlignment="Center" Grid.Column="2" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="InputGestureText" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="InputGestureText" Value="">
        <Setter Property="Visibility" TargetName="gestureTextBlock" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Background" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.Background}" />
        <Setter Property="BorderBrush" TargetName="iconImageBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.ToggleButton.Checked.BorderBrush}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="checkedImage" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="checkedImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="checkedImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.MenuItem" TargetType="{x:Type Fluent:MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.MenuItem.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Template" Value="{DynamicResource MenuItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource SplitedMenuItemTemplate}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource HeaderMenuItemTemplate}" />
      </MultiTrigger>
      <DataTrigger Binding="{Binding Description, RelativeSource={RelativeSource Self}, Converter={x:Static converters:IsNullConverter.Instance}}" Value="False">
        <Setter Property="Template" Value="{DynamicResource MenuItemWithDescriptionTemplate}" />
      </DataTrigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="MenuSeparatorStyle" TargetType="{x:Type Separator}">
    <Setter Property="Template" Value="{DynamicResource MenuSeparatorControlTemplate}" />
  </Style>
  <Style x:Key="MenuGroupSeparatorStyle" TargetType="{x:Type Fluent:GroupSeparatorMenuItem}">
    <Setter Property="Template" Value="{DynamicResource MenuGroupSeparatorControlTemplate}" />
  </Style>
  <Style TargetType="{x:Type Fluent:RibbonMenu}">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Fluent:RibbonMenu}">
          <ControlTemplate.Resources>
            <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
          </ControlTemplate.Resources>
          <Grid>
            <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" />
            <StackPanel x:Name="menuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Continue" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:Gallery}" x:Key="GalleryControlTemplate">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" x:Name="layoutRoot">
      <Grid Width="Auto">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Border x:Name="border" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="{DynamicResource Fluent.Ribbon.Brushes.Gallery.Header.Background}">
          <Fluent:DropDownButton x:Name="PART_DropDownButton" Style="{DynamicResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Header="{TemplateBinding SelectedFilterTitle}" />
        </Border>
        <ScrollViewer x:Name="scrollViewer" Grid.RowSpan="1" Grid.Row="1" Margin="1" Focusable="False">
          <Fluent:GalleryPanel Background="{DynamicResource WhiteBrush}" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" MinItemsInRow="{TemplateBinding MinItemsInRow}" MaxItemsInRow="{TemplateBinding MaxItemsInRow}" Filter="{TemplateBinding SelectedFilterGroups}" IsGrouped="{TemplateBinding IsGrouped}" GroupBy="{TemplateBinding GroupBy}" GroupByAdvanced="{TemplateBinding GroupByAdvanced}" IsItemsHost="True" ItemHeight="{TemplateBinding ItemHeight}" ItemWidth="{TemplateBinding ItemWidth}" Orientation="{TemplateBinding Orientation}" />
        </ScrollViewer>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="HasFilter" Value="False">
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="GalleryStyle" TargetType="{x:Type Fluent:Gallery}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="Template" Value="{DynamicResource GalleryControlTemplate}" />
    <Setter Property="Margin" Value="0" />
    <Setter Property="BorderThickness" Value="0,0,0,1" />
    <Style.Triggers>
      <Trigger Property="IsLastItem" Value="True">
        <Setter Property="BorderThickness" Value="0" />
      </Trigger>
      <Trigger Property="Orientation" Value="Vertical">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="Orientation" Value="Horizontal">
        <Setter Property="ItemsPanel">
          <Setter.Value>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
          </Setter.Value>
        </Setter>
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="InRibbonGalleryToggleButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{DynamicResource InRibbonGalleryToggleButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="31" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:InRibbonGallery}" x:Key="InRibbonGalleryControlTemplate">
    <Grid Width="Auto" Height="Auto" x:Name="PART_LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
      <Border x:Name="border" Width="Auto" Height="{TemplateBinding GalleryPanelContainerHeight}" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" ClipToBounds="True" Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid Width="Auto" Height="Auto">
          <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible">
            <ScrollViewer.Resources>
              <Style TargetType="{x:Type ScrollBar}">
                <Setter Property="Template">
                  <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                      <StackPanel HorizontalAlignment="Right" Margin="0,-1,-1,0">
                        <RepeatButton x:Name="upButton" Width="15" Height="21" Command="ScrollBar.PageUpCommand" Margin="0,0,0,0" Style="{DynamicResource InRibbonGalleryRepeatButton}">
                          <Path RenderOptions.EdgeMode="Aliased" Data="M0,0 L1,-1 2,0z" Fill="{DynamicResource BlackBrush}" Width="5" Height="3" Stretch="Fill" />
                        </RepeatButton>
                        <RepeatButton x:Name="downButton" Width="15" Height="21" Command="ScrollBar.PageDownCommand" Margin="0,-1,0,0" Style="{DynamicResource InRibbonGalleryRepeatButton}">
                          <Path RenderOptions.EdgeMode="Aliased" Data="M0,0 L1,1 2,0z" Fill="{DynamicResource BlackBrush}" Width="5" Height="3" Stretch="Fill" />
                        </RepeatButton>
                      </StackPanel>
                    </ControlTemplate>
                  </Setter.Value>
                </Setter>
                <Setter Property="ContextMenu" Value="{x:Null}" />
              </Style>
            </ScrollViewer.Resources>
            <ContentControl x:Name="PART_ContentPresenter" Focusable="False">
              <Fluent:GalleryPanel x:Name="PART_GalleryPanel" ItemContainerGenerator="{Binding ItemContainerGenerator, RelativeSource={RelativeSource TemplatedParent}}" Background="{DynamicResource WhiteBrush}" IsItemsHost="True" ItemHeight="{TemplateBinding ItemHeight}" ItemWidth="{TemplateBinding ItemWidth}" Orientation="{TemplateBinding Orientation}" Filter="{TemplateBinding SelectedFilterGroups}" GroupBy="{TemplateBinding GroupBy}" GroupByAdvanced="{TemplateBinding GroupByAdvanced}" IsGrouped="False" />
            </ContentControl>
          </ScrollViewer>
          <Fluent:ToggleButton IsDefinitive="False" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="15" Height="20" x:Name="PART_ExpandButton" Style="{DynamicResource InRibbonGalleryButton}" Margin="0,0,-1,-1" ClickMode="Press" CanAddToQuickAccessToolBar="False" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource = {RelativeSource TemplatedParent}}" />
          <Popup x:Name="PART_Popup" Placement="Custom" CustomPopupPlacementCallback="{x:Static FluentHelpers:PopupHelper.SimplePlacementCallback}" PlacementTarget="{Binding ElementName=PART_LayoutRoot}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
            <Popup.Resources>
              <ResourceDictionary>
                <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
              </ResourceDictionary>
            </Popup.Resources>
            <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
              <Border x:Name="PART_DropDownBorder" MinWidth="{Binding ActualWidth, ElementName=PART_LayoutRoot}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
                  <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
                  <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                      <RowDefinition Height="*" />
                      <RowDefinition Height="Auto" />
                      <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="2" Visibility="Visible" VerticalAlignment="Stretch" />
                    <Grid x:Name="PART_MenuPanel" MinWidth="{Binding MinWidth, ElementName=PART_DropDownBorder}" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
                      <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                      </Grid.RowDefinitions>
                      <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}">
                        <Grid Width="Auto">
                          <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                          </Grid.RowDefinitions>
                          <Border Grid.Row="0" x:Name="border_" BorderBrush="{x:Null}" BorderThickness="0" Height="13" Background="{DynamicResource Fluent.Ribbon.Brushes.Gallery.Header.Background}">
                            <Fluent:DropDownButton x:Name="PART_FilterDropDownButton" Style="{DynamicResource GalleryDropDownButtonStyle}" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Header="{TemplateBinding SelectedFilterTitle}" />
                          </Border>
                          <ScrollViewer x:Name="PART_ScrollViewer" Grid.Row="1" MinHeight="{Binding ActualHeight, ElementName=PART_LayoutRoot}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" BorderThickness="0,0,0,1" Margin="1">
                            <ContentControl x:Name="PART_PopupContentPresenter" Content="{x:Null}" />
                          </ScrollViewer>
                        </Grid>
                      </Border>
                      <ContentPresenter x:Name="PART_PopupMenuPresenter" ContentSource="Menu" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
                    </Grid>
                    <Border x:Name="PART_PopupResizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="2" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                      <Grid>
                        <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                        <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                      </Grid>
                    </Border>
                  </Grid>
                </Grid>
              </Border>
            </Grid>
          </Popup>
        </Grid>
      </Border>
      <Fluent:ToggleButton IsDefinitive="False" Margin="0,0,0,0" Visibility="Collapsed" x:Name="PART_DropDownButton" Icon="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}}" LargeIcon="{Binding Path=LargeIcon, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Path=Header, RelativeSource={RelativeSource TemplatedParent}}" Size="{Binding Path=Size, RelativeSource={RelativeSource TemplatedParent}}" SizeDefinition="{Binding Path=SizeDefinition, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource InRibbonGalleryToggleButtonStyle}" HorizontalAlignment="Left" VerticalAlignment="Top" ClickMode="Press" CanAddToQuickAccessToolBar="False" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource = {RelativeSource TemplatedParent}}" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="HasFilter" Value="False">
        <Setter Property="Visibility" TargetName="border_" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_DropDownButton" Value="False" />
        <Setter Property="IsEnabled" TargetName="PART_ExpandButton" Value="False" />
      </Trigger>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" TargetName="border" Value="Collapsed" />
        <Setter Property="Placement" TargetName="PART_Popup" Value="Bottom" />
        <Setter Property="Visibility" TargetName="PART_DropDownButton" Value="Visible" />
        <Setter Property="VerticalAlignment" TargetName="PART_LayoutRoot" Value="Top" />
        <Setter Property="HorizontalAlignment" TargetName="PART_LayoutRoot" Value="Left" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="PART_PopupResizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="PART_PopupResizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="PART_PopupResizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Menu" Value="{x:Null}">
        <Setter Property="BorderThickness" TargetName="PART_ScrollViewer" Value="0" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="{x:Type Fluent:InRibbonGallery}" TargetType="{x:Type Fluent:InRibbonGallery}">
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template" Value="{DynamicResource InRibbonGalleryControlTemplate}" />
    <Setter Property="Margin" Value="2,3,3,0" />
    <Style.Triggers>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Margin" Value="0" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="BackstageControlTemplate" TargetType="{x:Type Fluent:BackstageTabControl}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.Button}" />
        <Style x:Key="{x:Type Fluent:ToggleButton}" TargetType="{x:Type Fluent:ToggleButton}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.ToggleButton}" />
        <Style x:Key="{x:Type Fluent:DropDownButton}" TargetType="{x:Type Fluent:DropDownButton}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.DropDownButton}" />
        <Style x:Key="{x:Type Fluent:ComboBox}" TargetType="{x:Type Fluent:ComboBox}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.ComboBox}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition MinWidth="{TemplateBinding ItemsPanelMinWidth}" Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid x:Name="PART_ItemsPanelGrid" VerticalAlignment="Stretch" Background="{DynamicResource WhiteBrush}">
        <Grid Background="{TemplateBinding ItemsPanelBackground}">
          <Fluent:WindowSteeringHelperControl Height="{Binding SelectedContentMargin.Top, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Top" IsEnabled="{TemplateBinding IsWindowSteeringHelperEnabled}" />
          <Button x:Name="backbutton" Style="{DynamicResource BackstageBackButtonStyle}" Command="{x:Static Fluent:RibbonCommands.OpenBackstage}" Visibility="{Binding Path=IsBackButtonVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolToVisibilityConverter}}" Margin="0,16,0,0" Padding="22,7,0,7" VerticalAlignment="Top" />
          <ItemsPresenter Margin="0,77,0,0" Height="Auto" />
        </Grid>
      </Grid>
      <Grid x:Name="PART_SelectedContentGrid" Height="Auto" Grid.Column="1" Margin="{TemplateBinding SelectedContentMargin}" Background="{DynamicResource WhiteBrush}">
        <Border Background="{TemplateBinding Background}">
          <ContentPresenter x:Name="PART_SelectedContentHost" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" ContentSource="SelectedContent" />
        </Border>
      </Grid>
    </Grid>
  </ControlTemplate>
  <Style x:Key="BackstageStyle" TargetType="{x:Type Fluent:BackstageTabControl}">
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Template" Value="{DynamicResource BackstageControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="Background" Value="{DynamicResource WhiteBrush}" />
    <Setter Property="ItemsPanelBackground" Value="{DynamicResource Fluent.Ribbon.Brushes.BackstageTabControl.ItemsPanelBackground}" />
    <Setter Property="ItemContainerStyleSelector" Value="{x:Static styleSelectors:BackstageTabControlItemContainerStyleSelector.Instance}" />
    <Setter Property="SelectedContentMargin">
      <Setter.Value>
        <MultiBinding Converter="{x:Static converters:StaticConverters.ThicknessConverter}">
          <Binding Source="0" />
          <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Fluent:IRibbonWindow}}" Path="TitleBar.ActualHeight" FallbackValue="0" />
          <Binding Source="0" />
          <Binding Source="0" />
        </MultiBinding>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate x:Key="StartScreenTabControlTemplate" TargetType="{x:Type Fluent:StartScreenTabControl}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.Button}" />
        <Style x:Key="{x:Type Fluent:DropDownButton}" TargetType="{x:Type Fluent:DropDownButton}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.DropDownButton}" />
        <Style x:Key="{x:Type Fluent:ComboBox}" TargetType="{x:Type Fluent:ComboBox}" BasedOn="{StaticResource Fluent.Ribbon.Styles.Backstage.ComboBox}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid x:Name="grid">
      <Grid.ColumnDefinitions>
        <ColumnDefinition MinWidth="{TemplateBinding ItemsPanelMinWidth}" Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <Grid x:Name="PART_LeftContentGrid" VerticalAlignment="Stretch" Background="{TemplateBinding ItemsPanelBackground}" Margin="{TemplateBinding LeftContentMargin}">
        <Border Padding="15,25">
          <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Content="{TemplateBinding LeftContent}" />
        </Border>
        <Fluent:WindowSteeringHelperControl Height="{Binding SelectedContentMargin.Top, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Top" IsEnabled="{TemplateBinding IsWindowSteeringHelperEnabled}" />
      </Grid>
      <Grid x:Name="PART_SelectedContentGrid" Height="Auto" Grid.Column="1" Background="{DynamicResource WhiteBrush}" Margin="{TemplateBinding SelectedContentMargin}">
        <Border Padding="33,16" Background="{DynamicResource WhiteBrush}">
          <ContentPresenter x:Name="PART_SelectedContentHost" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Content="{TemplateBinding RightContent}" />
        </Border>
      </Grid>
    </Grid>
  </ControlTemplate>
  <Style x:Key="RibbonToolBarControlGroupStyle" TargetType="{x:Type Fluent:RibbonToolBarControlGroup}">
    <Setter Property="Template" Value="{DynamicResource RibbonToolBarControlGroupTemplate}" />
    <Setter Property="Focusable" Value="False" />
  </Style>
  <ControlTemplate x:Key="RibbonStatusBarContextMenuItemControlTemplate" TargetType="{x:Type Fluent:StatusBarMenuItem}">
    <Grid Width="Auto" Height="Auto" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="25" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock" Text="{Binding StatusBarItem.Title, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" Margin="5,3,3,3" VerticalAlignment="Center" Grid.Column="1" TextTrimming="CharacterEllipsis" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <Image x:Name="iconImage" HorizontalAlignment="Center" Margin="3,2,2,2" VerticalAlignment="Center" Width="Auto" Stretch="Uniform" Source="{TemplateBinding Icon}" SnapsToDevicePixels="True" />
      <TextBlock Text="{Binding StatusBarItem.Value, RelativeSource={RelativeSource TemplatedParent}}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="3" TextTrimming="CharacterEllipsis" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,4,0" Width="4" Data="M0,0L1,1 0,2z" Height="6" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="HasItems" Value="False">
        <Setter Property="Visibility" TargetName="path" Value="Collapsed" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonComboButtonStyle" TargetType="{x:Type Fluent:ToggleButton}">
    <Setter Property="Template" Value="{DynamicResource RibbonComboButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Fluent:ComboBox}" x:Key="ComboboxControlTemplate">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="Auto" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <StackPanel Orientation="Horizontal" Grid.ColumnSpan="1" x:Name="headerAndIconPanel" HorizontalAlignment="Left" Margin="0,0,4,0">
        <ContentPresenter x:Name="iconImage" Width="16" Height="16" VerticalAlignment="Center" Margin="3,0,0,0" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition SharedSizeGroup="{Binding Path=(Fluent:RibbonGroupBoxWrapPanel.SharedSizeGroupName), RelativeSource={RelativeSource TemplatedParent}}" />
          </Grid.ColumnDefinitions>
          <TextBlock Text="{TemplateBinding Header}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" x:Name="headerTextBlock" />
        </Grid>
      </StackPanel>
      <Border Height="Auto" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.BorderBrush}" x:Name="PART_ContentBorder" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Grid.Column="1" Grid.ColumnSpan="1" Width="{TemplateBinding InputWidth}" d:LayoutOverrides="GridBox" HorizontalAlignment="Right">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="13" />
          </Grid.ColumnDefinitions>
          <Fluent:ToggleButton IsDefinitive="False" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="0" ClickMode="Press" Height="Auto" VerticalAlignment="Stretch" Grid.ColumnSpan="2" Margin="0" Style="{DynamicResource RibbonComboButtonStyle}" CanAddToQuickAccessToolBar="False" />
          <ContentPresenter Margin="3,0,3,0" x:Name="PART_ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" VerticalAlignment="Center" HorizontalAlignment="Left" />
          <Image Margin="0" Stretch="None" x:Name="PART_SelectedImage" IsHitTestVisible="False" VerticalAlignment="Top" HorizontalAlignment="Left" Visibility="Collapsed" Width="Auto" Height="Auto" />
          <TextBox x:Name="PART_EditableTextBox" Focusable="True" Style="{x:Null}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" TextWrapping="NoWrap" BorderThickness="0,0,0,0" IsReadOnly="{TemplateBinding IsReadOnly}" Background="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Background}" Foreground="{TemplateBinding Foreground}" CaretBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.CaretBrush}" SelectionBrush="{DynamicResource Fluent.Ribbon.Brushes.TextBox.SelectionBrush}" Visibility="Hidden" />
        </Grid>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_ContentBorder}" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Popup.Resources>
          <ResourceDictionary>
            <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
          </ResourceDictionary>
        </Popup.Resources>
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="PART_DropDownBorder" Margin="0" MinWidth="{Binding ActualWidth, ElementName=PART_ContentBorder}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" KeyboardNavigation.DirectionalNavigation="Cycle">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Rectangle Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Grid.RowSpan="3" Visibility="Visible" VerticalAlignment="Stretch" />
                <ContentControl x:Name="upResizeContent" />
                <Grid Grid.Row="1" x:Name="PART_MenuPanel" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalAlignment="Top">
                  <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>
                  <ScrollViewer Focusable="False" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Control.BorderBrush}" x:Name="PART_ScrollViewer" Background="{DynamicResource WhiteBrush}" Margin="1" SnapsToDevicePixels="True" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Stretch" BorderThickness="0,0,0,1">
                    <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                  </ScrollViewer>
                  <ContentPresenter x:Name="menuPresenter" ContentSource="Menu" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="None" VerticalAlignment="Top" />
                </Grid>
                <ContentControl x:Name="downResizeContent" Grid.Row="2">
                  <Border RenderTransformOrigin="0.5, 0.5" x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                    <Grid>
                      <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                      <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                    </Grid>
                  </Border>
                </ContentControl>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="Menu" Value="{x:Null}">
        <Setter Property="BorderThickness" TargetName="PART_ScrollViewer" Value="0" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Icon" Value="{x:Null}">
        <Setter Property="Visibility" TargetName="iconImage" Value="Collapsed" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Visibility" TargetName="headerTextBlock" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Visibility" TargetName="headerAndIconPanel" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="InputWidth" Value="NaN">
        <Setter Property="HorizontalAlignment" TargetName="PART_ContentBorder" Value="Stretch" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_EditableTextBox" Value="False" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.BorderBrush}" />
        <Setter Property="BorderBrush" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.Disabled.Background}" />
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="headerTextBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_EditableTextBox" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
        <Setter Property="Background" TargetName="PART_ContentBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.TextBox.MouseOver.Background}" />
      </Trigger>
      <Trigger Property="HasItems" Value="false">
        <Setter TargetName="PART_DropDownBorder" Property="MinHeight" Value="95" />
      </Trigger>
      <Trigger Property="IsGrouping" Value="true">
        <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
      </Trigger>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false" />
        <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
        <Setter TargetName="PART_ContentSite" Property="Visibility" Value="Hidden" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ComboBox}">
    <Setter Property="Height" Value="22" />
    <Setter Property="Template" Value="{DynamicResource ComboboxControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="IsEditable" Value="True" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
    <Style.Triggers>
      <Trigger Property="ItemContainerStyleSelector" Value="{x:Null}">
        <Setter Property="ItemContainerStyle" Value="{DynamicResource ComboBoxItemStyle}" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="RibbonControlTemplate" TargetType="{x:Type Fluent:Ribbon}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
    </ControlTemplate.Resources>
    <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
      <Grid x:Name="PART_LayoutRoot" Width="Auto" Height="Auto">
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Fluent:RibbonTabControl x:Name="PART_RibbonTabControl" Menu="{TemplateBinding Menu}" ContentHeight="{TemplateBinding ContentHeight}" ContextMenu="{Binding ContextMenu, ElementName=PART_LayoutRoot}" AreTabHeadersVisible="{TemplateBinding AreTabHeadersVisible}" IsToolBarVisible="{TemplateBinding IsToolBarVisible}" IsMouseWheelScrollingEnabled="{TemplateBinding IsMouseWheelScrollingEnabled}" />
        <ContentControl x:Name="quickAccessToolBarHolder" Grid.Row="1" Height="{TemplateBinding QuickAccessToolBarHeight}" HorizontalAlignment="Left">
          <Fluent:QuickAccessToolBar x:Name="PART_QuickAccessToolBar" ShowAboveRibbon="{Binding ShowQuickAccessToolBarAboveRibbon, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsMenuDropDownVisible="{TemplateBinding IsQuickAccessToolBarMenuDropDownVisible}" HorizontalAlignment="Left" Focusable="False" />
        </ContentControl>
      </Grid>
    </Border>
    <ControlTemplate.Triggers>
      <Trigger Property="IsQuickAccessToolBarVisible" Value="False">
        <Setter Property="Visibility" TargetName="quickAccessToolBarHolder" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_QuickAccessToolBar" Value="Collapsed" />
      </Trigger>
      <Trigger Property="IsCollapsed" Value="True">
        <Setter Property="Visibility" TargetName="PART_RibbonTabControl" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="quickAccessToolBarHolder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="QuickAccessToolBar" Value="{x:Null}">
        <Setter Property="Content" TargetName="quickAccessToolBarHolder" Value="{x:Null}" />
        <Setter Property="Visibility" TargetName="quickAccessToolBarHolder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ShowQuickAccessToolBarAboveRibbon" Value="True">
        <Setter Property="Content" TargetName="quickAccessToolBarHolder" Value="{x:Null}" />
        <Setter Property="Visibility" TargetName="quickAccessToolBarHolder" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="RibbonStyle" TargetType="{x:Type Fluent:Ribbon}">
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Ribbon.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Template" Value="{DynamicResource RibbonControlTemplate}" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Fluent:FrameworkHelper.UseLayoutRounding" Value="True" />
    <Setter Property="TitleBar" Value="{Binding TitleBar, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Fluent:IRibbonWindow}}, FallbackValue={x:Null}}" />
    <Setter Property="QuickAccessToolBarHeight" Value="{Binding TitleBar.ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:IRibbonWindow}}, FallbackValue=23}" />
  </Style>
  <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="Height" Value="14" />
    <Setter Property="Width" Value="14" />
    <Setter Property="Template" Value="{DynamicResource SliderThumbControlTemplate}" />
  </Style>
  <ControlTemplate TargetType="{x:Type Slider}" x:Key="ZoomSliderControlTemplate">
    <Grid Height="16" Width="133">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="16" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="16" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.ColumnSpan="1" Margin="0,-1,0,0" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Height="1" Grid.Column="1" />
      <!--<Rectangle Grid.ColumnSpan="1" Margin="-1,0,0,0" Stroke="{DynamicResource SliderShadowBrush}" VerticalAlignment="Center" Height="7" Grid.Column="1" Width="1" HorizontalAlignment="Center"/>-->
      <Rectangle Grid.ColumnSpan="1" Margin="0,1,0,0" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Height="1" Grid.Column="1" />
      <Rectangle Grid.ColumnSpan="1" Margin="0,1,0,1" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center" Height="7" Grid.Column="1" Width="1" HorizontalAlignment="Center" />
      <Rectangle x:Name="rectangle" Grid.ColumnSpan="1" Margin="0" Stroke="{x:Null}" Grid.Column="1" StrokeThickness="0" Fill="Transparent" />
      <Track Grid.Row="0" x:Name="PART_Track" Height="16" Grid.ColumnSpan="1" Grid.Column="1">
        <Track.DecreaseRepeatButton>
          <RepeatButton Style="{DynamicResource SliderButtonStyle}" Command="Slider.DecreaseLarge" x:Name="leftButton" />
        </Track.DecreaseRepeatButton>
        <Track.Thumb>
          <Thumb x:Name="thumb" Style="{DynamicResource SliderThumbStyle}" />
        </Track.Thumb>
        <Track.IncreaseRepeatButton>
          <RepeatButton Style="{DynamicResource SliderButtonStyle}" Command="Slider.IncreaseLarge" x:Name="rightButton" />
        </Track.IncreaseRepeatButton>
      </Track>
      <RepeatButton x:Name="repeatButton" Style="{DynamicResource SliderRepeatButtonStyle}" Command="Slider.DecreaseLarge">
        <Grid Margin="0" Background="Transparent" IsHitTestVisible="True">
          <Path Data="M0,0L1,0" Fill="{x:Null}" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="10" VerticalAlignment="Center" Height="2" StrokeThickness="2" Stroke="{TemplateBinding Foreground}" />
        </Grid>
      </RepeatButton>
      <RepeatButton x:Name="repeatButton_Copy" Style="{DynamicResource SliderRepeatButtonStyle}" Grid.Column="2" Command="Slider.IncreaseLarge">
        <Grid Margin="0" Background="Transparent" IsHitTestVisible="True">
          <Path Data="M0,0L0,1" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="2" VerticalAlignment="Center" Height="10" StrokeThickness="2" Stroke="{TemplateBinding Foreground}" />
          <Path Data="M0,0L1,0" HorizontalAlignment="Center" Margin="0" Stretch="Fill" Width="10" VerticalAlignment="Center" Height="2" StrokeThickness="2" Stroke="{TemplateBinding Foreground}" />
        </Grid>
      </RepeatButton>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsMouseOver" Value="True" SourceName="leftButton">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True" SourceName="rightButton">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
      <Trigger Property="IsMouseOver" Value="True" SourceName="thumb">
        <Setter Property="Background" TargetName="thumb" Value="Red" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:BackstageTabControl}" BasedOn="{StaticResource BackstageStyle}" />
  <Style TargetType="{x:Type Fluent:ToggleButton}" BasedOn="{StaticResource RibbonToggleButtonStyle}" />
  <Style TargetType="{x:Type Fluent:Gallery}" BasedOn="{StaticResource GalleryStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonContextualTabGroup}" BasedOn="{StaticResource RibbonContextualTabGroupStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonToolBarControlGroup}" BasedOn="{StaticResource RibbonToolBarControlGroupStyle}" />
  <Style TargetType="{x:Type Fluent:Ribbon}" BasedOn="{StaticResource RibbonStyle}" />
  <Style TargetType="{x:Type Fluent:MenuItem}" BasedOn="{StaticResource Fluent.Ribbon.Styles.MenuItem}" />
  <Style TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
  <ControlTemplate x:Key="ApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" MinHeight="53" Height="Auto" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" SnapsToDevicePixels="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" MinHeight="53" Height="Auto" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" CornerRadius="2,2,1,1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer VerticalScrollBarVisibility="Auto" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" MaxWidth="{Binding ActualWidth, ElementName=PART_ScrollViewer}" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedApplicationMenuSecondLevelItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" MinHeight="53" Height="Auto" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Margin="0,0,-1,0" />
        <Border x:Name="Submenu_Border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="1" />
      </Grid>
      <TextBlock x:Name="textBlock" FontWeight="Bold" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,5,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Stretch" Height="Auto" Margin="9,22,3,3" VerticalAlignment="Top" Grid.Column="1" d:LayoutOverrides="Width" TextWrapping="Wrap" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,4,0,0" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Top" Margin="3,4,2,2" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" CornerRadius="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Path Fill="{x:Null}" Stretch="Fill" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" HorizontalAlignment="Left" Margin="24,0,0,0" Width="1" Height="Auto" Data="M0,0L0,1" Grid.RowSpan="2" Visibility="Visible" />
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" MaxWidth="{Binding ActualWidth, ElementName=PART_ScrollViewer}" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="Submenu_Border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Background" TargetName="Submenu_Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.ApplicationMenu.MenuItemSecondLevel" TargetType="{x:Type Fluent:MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="ResizeMode" Value="None" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template" Value="{DynamicResource ApplicationMenuSecondLevelItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource SplitedApplicationMenuSecondLevelItemTemplate}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource HeaderApplicationMenuSecondLevelItemTemplate}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <TextBlock x:Name="textBlockDesc" Text="{TemplateBinding Description}" Width="Auto" HorizontalAlignment="Right" Height="Auto" Margin="0,3,3,3" VerticalAlignment="Center" Grid.Column="2" d:LayoutOverrides="Width" TextWrapping="NoWrap" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="HeaderApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Border x:Name="border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="0" Grid.ColumnSpan="3" />
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Custom" CustomPopupPlacementCallback="{x:Static FluentHelpers:PopupHelper.SimplePlacementCallback}" PlacementTarget="{Binding Converter={StaticResource ApplicationMenuRightScrollViewerExtractorConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="{Binding RightPaneWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" CornerRadius="2,2,1,1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" x:Name="PART_ScrollViewer" Margin="1" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" MaxWidth="{Binding ActualWidth, ElementName=PART_ScrollViewer}" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="SplitedApplicationMenuItemTemplate" TargetType="{x:Type Fluent:MenuItem}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource MenuScrollViewer}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid Width="Auto" Height="44" Background="Transparent">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="44" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <Rectangle Grid.Column="2" HorizontalAlignment="Right" Margin="0,4,23,4" Stroke="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" Width="1" />
      <Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto" Grid.Column="0" Grid.ColumnSpan="3">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="0.905*" />
          <ColumnDefinition x:Name="columnDefinition" Width="23" />
        </Grid.ColumnDefinitions>
        <Border x:Name="PART_ButtonBorder" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Margin="0,0,-1,0" />
        <Border x:Name="Submenu_Border" HorizontalAlignment="Stretch" Margin="0" Width="Auto" Visibility="Collapsed" Background="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" BorderThickness="1" CornerRadius="2" Grid.Column="1" />
      </Grid>
      <TextBlock x:Name="textBlock" Text="{TemplateBinding Header}" Width="Auto" Height="Auto" Margin="9,3,3,3" VerticalAlignment="Center" Grid.Column="1" d:LayoutOverrides="Width" TextTrimming="CharacterEllipsis" />
      <Rectangle x:Name="rectangle" Fill="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.Background}" Stroke="{DynamicResource Fluent.Ribbon.Brushes.ApplicationMenuItem.CheckBox.BorderBrush}" Grid.ColumnSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="40" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
      <Image x:Name="image" HorizontalAlignment="Center" VerticalAlignment="Center" Width="32" Height="32" Stretch="Uniform" Source="{DynamicResource Fluent.Ribbon.Images.Checked}" Visibility="Collapsed" SnapsToDevicePixels="True" />
      <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="3,2,2,2" SnapsToDevicePixels="True" />
      <Path x:Name="path" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="1,0,9,0" Width="4" Data="M0,0L1,1 0,2z" Height="7" Grid.Column="3" Fill="{DynamicResource Fluent.Ribbon.MenuItem.SubMenu.Arrow.Fill}" />
      <Popup x:Name="PART_Popup" Placement="Custom" CustomPopupPlacementCallback="{x:Static FluentHelpers:PopupHelper.SimplePlacementCallback}" PlacementTarget="{Binding Converter={StaticResource ApplicationMenuRightScrollViewerExtractorConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Margin="0,0,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="{Binding RightPaneWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:ApplicationMenu}}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}">
        <Grid x:Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Stretch">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="4" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="4" />
          </Grid.ColumnDefinitions>
          <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="4" Grid.Row="1" Grid.Column="1" StrokeThickness="0" Margin="-1,-1,0,0">
            <Rectangle.Fill>
              <RadialGradientBrush RadiusX="0.984" Center="0.017,0.002" GradientOrigin="0.017,0.002" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,3,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.032,1.01" GradientOrigin="0.032,1.01" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="3,-1,0,0" VerticalAlignment="Top" Width="4" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <RadialGradientBrush Center="0.996,0.027" GradientOrigin="0.996,0.027" RadiusX="0.984" RadiusY="1">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </RadialGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Stretch" Margin="7,-1,1,0" VerticalAlignment="Top" Width="Auto" Height="4" Grid.Column="0" Grid.Row="1">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Rectangle StrokeThickness="0" HorizontalAlignment="Left" Margin="-1,7,0,1" VerticalAlignment="Stretch" Width="4" Height="Auto" Grid.Column="1" Grid.Row="0">
            <Rectangle.Fill>
              <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5" MappingMode="RelativeToBoundingBox">
                <GradientStop Color="#3F000000" Offset="0" />
                <GradientStop Color="Transparent" Offset="1" />
              </LinearGradientBrush>
            </Rectangle.Fill>
          </Rectangle>
          <Border x:Name="DropDownBorder" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" CornerRadius="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
              <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" CornerRadius="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer Margin="1" x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" SnapsToDevicePixels="True">
                  <StackPanel x:Name="PART_MenuPanel" MaxWidth="{Binding ActualWidth, ElementName=PART_ScrollViewer}" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="Visibility" TargetName="rectangle" Value="Visible" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Icon" Value="{x:Null}" />
          <Condition Property="IsChecked" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="image" Value="Visible" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsHighlighted" Value="True" />
          <Condition Property="IsEnabled" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="PART_ButtonBorder" Value="Visible" />
        <Setter Property="Visibility" TargetName="Submenu_Border" Value="Visible" />
      </MultiTrigger>
      <Trigger Property="IsSubmenuOpen" Value="True">
        <Setter Property="Background" TargetName="Submenu_Border" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="image" Value="0.5" />
        <Setter Property="Opacity" TargetName="textBlock" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
        <Setter Property="Effect" TargetName="image">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="Fluent.Ribbon.Styles.ApplicationMenu.MenuItem" TargetType="{x:Type Fluent:MenuItem}">
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="ResizeMode" Value="None" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="OverridesDefaultStyle" Value="True" />
    <Setter Property="Template" Value="{DynamicResource ApplicationMenuItemTemplate}" />
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="True" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource SplitedApplicationMenuItemTemplate}" />
        <Setter Property="ItemContainerStyleSelector" Value="{x:Static styleSelectors:SplitedApplicationMenuItemItemContainerStyleSelector.Instance}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Fluent:MenuItem.IsSplited" Value="False" />
          <Condition Property="HasItems" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Template" Value="{DynamicResource HeaderApplicationMenuItemTemplate}" />
        <Setter Property="ItemContainerStyleSelector" Value="{x:Static styleSelectors:HeaderApplicationMenuItemItemContainerStyleSelector.Instance}" />
      </MultiTrigger>
    </Style.Triggers>
  </Style>
  <ControlTemplate x:Key="ApplicationMenuButtonControlTemplate" TargetType="{x:Type Fluent:ApplicationMenu}">
    <Grid Margin="0">
      <ContentControl x:Name="buttonContent" Width="{Binding ActualWidth, ElementName=PART_ButtonBorder}" Height="{Binding ActualHeight, ElementName=PART_ButtonBorder}" Margin="0">
        <Border x:Name="PART_ButtonBorder" MinWidth="60" Height="23" Background="{TemplateBinding Background}">
          <ContentControl x:Name="contentPresenter" Content="{TemplateBinding Header}" Margin="10,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" />
        </Border>
      </ContentControl>
      <Popup x:Name="PART_Popup" Placement="Custom" CustomPopupPlacementCallback="{x:Static FluentHelpers:PopupHelper.SimplePlacementCallback}" PlacementTarget="{Binding ElementName=buttonContent}" VerticalOffset="{Binding ElementName=buttonContent, Path=ActualHeight}" IsOpen="{TemplateBinding IsDropDownOpen}" MaxHeight="{TemplateBinding MaxDropDownHeight}" AllowsTransparency="True" Focusable="False" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" MinHeight="17" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" MinWidth="100" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <ScrollViewer Style="{DynamicResource MenuScrollViewer}" Grid.Row="0" Grid.Column="0" IsTabStop="False" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                  <StackPanel Orientation="Vertical" ScrollViewer.VerticalScrollBarVisibility="Auto" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border Grid.Row="0" Grid.Column="1" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" Width="{TemplateBinding RightPaneWidth}">
                  <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" IsTabStop="False" Margin="1" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                    <ContentPresenter ContentSource="RightPaneContent" x:Name="PART_RightContentPresenter" />
                  </ScrollViewer>
                </Border>
                <Border Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.Separator.BorderBrush}" Background="{DynamicResource Fluent.Ribbon.Brushes.Ribbon.Background}" Margin="0">
                  <ContentPresenter ContentSource="FooterPaneContent" />
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="PART_ButtonBorder" Value="0.5" />
        <Setter Property="Effect" TargetName="contentPresenter">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style TargetType="{x:Type Fluent:ApplicationMenu}">
    <Setter Property="Template" Value="{DynamicResource ApplicationMenuButtonControlTemplate}" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.IdealForegroundColorBrush}" />
    <Setter Property="Header" Value="{converters:ObjectToImageConverter {DynamicResource Fluent.Ribbon.Images.ApplicationMenu}, '40,16', {Binding RelativeSource={RelativeSource Self}}}" />
    <Setter Property="ItemContainerStyleSelector" Value="{x:Static styleSelectors:ApplicationMenuItemContainerStyleSelector.Instance}" />
  </Style>
  <Style x:Key="RibbonTabControlStyle" TargetType="{x:Type Fluent:RibbonTabControl}">
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Background}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabControl.Foreground}" />
    <Setter Property="Focusable" Value="False" />
    <Setter Property="Template" Value="{DynamicResource RibbonTabControlControlTemplate}" />
    <Setter Property="CanMinimize" Value="{Binding CanMinimize, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:Ribbon}}, Mode=TwoWay}" />
    <Setter Property="IsMinimized" Value="{Binding IsMinimized, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:Ribbon}}, Mode=TwoWay}" />
    <Setter Property="ContentGapHeight" Value="{Binding ContentGapHeight, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:Ribbon}}}" />
  </Style>
  <ControlTemplate x:Key="RibbonGroupBoxControlTemplate" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <ControlTemplate.Resources>
      <ResourceDictionary>
        <Style TargetType="Separator" BasedOn="{StaticResource GroupBoxSeparator}" />
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}" />
        <Style x:Key="{x:Type ScrollViewer}" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}" />
      </ResourceDictionary>
    </ControlTemplate.Resources>
    <Grid x:Name="grid2" HorizontalAlignment="Stretch">
      <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" />
      <Grid>
        <ContentControl x:Name="nonCollapsedStateBorder" Focusable="False">
          <Grid x:Name="PART_ParentPanel" Margin="0,1,0,2" Height="Auto">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Fluent:RibbonGroupBoxWrapPanel x:Name="PART_UpPanel" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsItemsHost="True" Margin="4,0,4,0" />
            <Grid x:Name="PART_DownGrid" MaxWidth="{Binding ActualWidth, ElementName=PART_ParentPanel}" Margin="0,-2,2,2" Grid.Row="1" VerticalAlignment="Bottom" Height="Auto">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>
              <ContentControl x:Name="PART_HeaderContentControl" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Foreground="{DynamicResource Fluent.Ribbon.Brushes.RibbonGroupBox.Header.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2,0" KeyboardNavigation.IsTabStop="False" />
              <Fluent:Button Margin="0,0,1,1" x:Name="PART_DialogLauncherButton" HorizontalAlignment="Stretch" Width="15" Height="14" Grid.Column="1" Focusable="False" IsTabStop="False" Template="{DynamicResource DialogLauncherButtonControlTemplate}" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" Icon="{TemplateBinding LauncherIcon}" Header="{TemplateBinding LauncherText}" Command="{Binding LauncherCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandTarget="{Binding LauncherCommandTarget, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding LauncherCommandParameter, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding LauncherToolTip, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsLauncherEnabled, RelativeSource={RelativeSource TemplatedParent}}" />
            </Grid>
          </Grid>
        </ContentControl>
        <Grid x:Name="collapsedStateGrid" Margin="0" Width="Auto" Height="Auto" Visibility="Collapsed" Grid.RowSpan="2">
          <ContentControl x:Name="PART_CollapsedHeaderContentControl" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Foreground="{DynamicResource Fluent.Ribbon.Brushes.RibbonGroupBox.Header.Foreground}" Style="{DynamicResource Fluent.Ribbon.Styles.RibbonGroupBox.TwoLineHeaderContentControl}" Fluent:RibbonGroupBox.IsCollapsedHeaderContentPresenter="True" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="5,38,5,0" KeyboardNavigation.IsTabStop="False" />
          <Border HorizontalAlignment="Center" VerticalAlignment="Top" Width="31" Height="31" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.RibbonGroupBox.Collapsed.BorderBrush}" BorderThickness="1" Margin="5,3,8,0">
            <ContentPresenter x:Name="iconImage" Height="16" Content="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="16" SnapsToDevicePixels="True" />
          </Border>
          <Popup x:Name="PART_Popup" Width="Auto" Height="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}" AllowsTransparency="True" PlacementTarget="{Binding ElementName=collapsedStateGrid, Mode=OneWay}" IsOpen="{TemplateBinding IsDropDownOpen}">
            <Border x:Name="border" Height="Auto" Background="{DynamicResource Fluent.Ribbon.Brushes.Ribbon.Background}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.RibbonTabItem.BorderBrush}" BorderThickness="1" d:LayoutOverrides="Width">
              <ContentControl x:Name="popupContent" />
            </Border>
          </Popup>
        </Grid>
        <Rectangle x:Name="separator" Fill="{DynamicResource Fluent.Ribbon.Brushes.GroupSeparator.Background}" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="1" Height="Auto" Grid.RowSpan="2" Margin="0,4" Visibility="{Binding IsSeparatorVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" />
      </Grid>
      <Image x:Name="PART_SnappedImage" Stretch="Uniform" Visibility="Collapsed" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="State" Value="Collapsed">
        <Setter Property="Visibility" TargetName="collapsedStateGrid" Value="Visible" />
        <Setter Property="UIElement.Visibility" TargetName="nonCollapsedStateBorder" Value="Collapsed" />
        <Setter Property="HorizontalAlignment" TargetName="grid2" Value="Left" />
        <Setter Property="Content" TargetName="nonCollapsedStateBorder" Value="{x:Null}" />
        <Setter Property="Content" TargetName="popupContent" Value="{Binding ElementName=PART_ParentPanel}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="State" Value="Collapsed" />
          <Condition Property="IsMouseOver" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonGroupBox.Collapsed.MouseOver.Background}" />
      </MultiTrigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.RibbonGroupBox.DropDownOpen.Background}" />
      </Trigger>
      <Trigger Property="IsLauncherVisible" Value="False">
        <Setter Property="Visibility" TargetName="PART_DialogLauncherButton" Value="Collapsed" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonDropDownButtonControlTemplate" TargetType="{x:Type Fluent:DropDownButton}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
    </ControlTemplate.Resources>
    <Grid>
      <Border x:Name="PART_ButtonBorder" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" Height="Auto">
        <StackPanel x:Name="stackPanel" Margin="{TemplateBinding Padding}" Width="Auto" Orientation="Vertical">
          <ContentPresenter x:Name="iconImage" HorizontalAlignment="Center" Height="32" VerticalAlignment="Center" Content="{converters:ObjectToImageConverter {Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}, '32,32', {Binding RelativeSource={RelativeSource TemplatedParent}}}" Width="32" Margin="0 2 0 0" SnapsToDevicePixels="True" />
          <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2 0 2 2" HasGlyph="{TemplateBinding HasTriangle}" />
        </StackPanel>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" IsTabStop="False" Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
                  <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Local" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2,0,0,0" />
        <Setter Property="Margin" TargetName="controlLabel" Value="-2,0,2,1" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Content" TargetName="iconImage" Value="{converters:ObjectToImageConverter {Binding Icon, RelativeSource={RelativeSource TemplatedParent}}, '16,16', {Binding RelativeSource={RelativeSource TemplatedParent}}}" />
        <Setter Property="Width" TargetName="stackPanel" Value="Auto" />
        <Setter Property="VerticalAlignment" TargetName="iconImage" Value="Center" />
        <Setter Property="HasTwoLines" TargetName="controlLabel" Value="False" />
        <Setter Property="Margin" TargetName="controlLabel" Value="2,0,2,1" />
        <Setter Property="VerticalAlignment" TargetName="PART_ButtonBorder" Value="Stretch" />
        <Setter Property="Width" TargetName="iconImage" Value="16" />
        <Setter Property="Height" TargetName="iconImage" Value="16" />
        <Setter Property="Margin" TargetName="iconImage" Value="2,0,2,0" />
        <Setter Property="VerticalAlignment" TargetName="controlLabel" Value="Center" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="Opacity" TargetName="iconImage" Value="0.5" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
        <Setter Property="Effect" TargetName="iconImage">
          <Setter.Value>
            <Fluent:GrayscaleEffect />
          </Setter.Value>
        </Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="RibbonSplitButtonControlTemplate" TargetType="{x:Type Fluent:SplitButton}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
    </ControlTemplate.Resources>
    <Grid>
      <Border BorderThickness="1" Name="PART_ButtonBorder" BorderBrush="Transparent" Background="Transparent" VerticalAlignment="Stretch">
        <StackPanel Orientation="Vertical" Name="stackPanel" KeyboardNavigation.TabNavigation="Local">
          <Fluent:ToggleButton x:Name="PART_Button" Command="{TemplateBinding Command}" CommandParameter="{TemplateBinding CommandParameter}" CommandTarget="{TemplateBinding CommandTarget}" Margin="0,0,0,0" Height="Auto" Width="Auto" Style="{DynamicResource InnerButtonStyle}" LargeIcon="{Binding LargeIcon, RelativeSource={RelativeSource TemplatedParent}}" Icon="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{Binding IsButtonEnabled, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Header="{TemplateBinding Header}" ToolTip="{TemplateBinding ToolTip}" GroupName="{Binding GroupName, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsChecked="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsDefinitive="{TemplateBinding IsDefinitive}" CanAddToQuickAccessToolBar="{TemplateBinding CanAddButtonToQuickAccessToolBar}" />
          <Border BorderThickness="0,0,0,0" Name="downBorder" BorderBrush="Transparent" Background="Transparent" Margin="0,0,0,0">
            <Grid>
              <Fluent:TwoLineLabel x:Name="controlLabel" Text="{TemplateBinding Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,1,2,2" HasGlyph="{TemplateBinding HasTriangle}" />
            </Grid>
          </Border>
        </StackPanel>
      </Border>
      <Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Margin="0,0,-4,0" VerticalAlignment="Top" Grid.ColumnSpan="2">
        <Grid Name="DropDown" IsEnabled="{TemplateBinding IsEnabled}" SnapsToDevicePixels="True" Margin="0" VerticalAlignment="Top">
          <Border x:Name="PART_DropDownBorder" MinWidth="{TemplateBinding ActualWidth}" SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <Grid Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Top">
              <Border VerticalAlignment="Top" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
              <Grid Margin="1" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" Margin="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
                  <StackPanel x:Name="PART_MenuPanel" Orientation="Vertical" IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                </ScrollViewer>
                <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
                  <Grid>
                    <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                    <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
                  </Grid>
                </Border>
              </Grid>
            </Grid>
          </Border>
        </Grid>
      </Popup>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="IsChecked" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Size" TargetName="PART_Button" Value="Small" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="Margin" TargetName="controlLabel" Value="0,-19,0,0" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
        <Setter Property="Padding" TargetName="downBorder" Value="1,0,0,0" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Size" TargetName="PART_Button" Value="Middle" />
        <Setter Property="Orientation" TargetName="stackPanel" Value="Horizontal" />
        <Setter Property="Width" TargetName="controlLabel" Value="10" />
        <Setter Property="Margin" TargetName="controlLabel" Value="0,-19,0,0" />
        <Setter Property="Text" TargetName="controlLabel" Value="" />
      </Trigger>
      <Trigger Property="IsButtonEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_Button" Value="False" />
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter Property="IsEnabled" TargetName="PART_Button" Value="False" />
        <Setter Property="Opacity" TargetName="controlLabel" Value="0.5" />
      </Trigger>
      <Trigger Property="IsDropDownOpen" Value="True">
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.BorderBrush}" />
        <Setter Property="Background" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="PART_Button" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="downBorder" />
          <Condition Property="IsDropDownOpen" Value="False" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" TargetName="PART_ButtonBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
        <Setter Property="Background" TargetName="downBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
        <Setter Property="BorderBrush" TargetName="downBorder" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.BorderBrush}" />
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <Style x:Key="ToolbarDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template" Value="{DynamicResource ToolbarDropDownButtonControlTemplate}" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="14" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
  </Style>
  <ControlTemplate x:Key="QuickAccessToolbarControlTemplate" TargetType="{x:Type Fluent:QuickAccessToolBar}">
    <DockPanel x:Name="PART_RootPanel" KeyboardNavigation.TabNavigation="Local">
      <ContentControl x:Name="menuContentControl" DockPanel.Dock="Right" HorizontalAlignment="Right" Focusable="False">
        <Fluent:DropDownButton CanAddToQuickAccessToolBar="False" x:Name="PART_MenuDownButton" HorizontalAlignment="Right" VerticalAlignment="Stretch" Style="{DynamicResource ToolbarDropDownButtonStyle}" DockPanel.Dock="Right" IsEnabled="{TemplateBinding IsEnabled}" Visibility="{Binding IsMenuDropDownVisible, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" Icon="{DynamicResource Fluent.Ribbon.Images.QuickAccessToolbarDropDown}" Size="Small" ToolTip="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.QuickAccessToolBarDropDownButtonTooltip, Mode=OneWay}" KeyboardNavigation.TabIndex="3">
          <Fluent:GroupSeparatorMenuItem Style="{DynamicResource MenuGroupSeparatorStyle}" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.QuickAccessToolBarMenuHeader, Mode=OneWay}" />
          <StackPanel x:Name="PART_MenuPanel" />
          <Separator x:Name="menuSeparator" Style="{DynamicResource MenuSeparatorStyle}" />
          <Fluent:MenuItem x:Name="PART_ShowBelow" CanAddToQuickAccessToolBar="False" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.QuickAccessToolBarMenuShowBelow, Mode=OneWay}" />
          <Fluent:MenuItem x:Name="PART_ShowAbove" CanAddToQuickAccessToolBar="False" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.QuickAccessToolBarMenuShowAbove, Mode=OneWay}" Visibility="Collapsed" />
        </Fluent:DropDownButton>
      </ContentControl>
      <Fluent:DropDownButton x:Name="PART_ToolbarDownButton" HorizontalAlignment="Right" Visibility="Collapsed" VerticalAlignment="Stretch" Style="{DynamicResource ToolbarDropDownButtonStyle}" DockPanel.Dock="Right" Fluent:KeyTip.Keys="00" Size="Small" IsEnabled="{TemplateBinding IsEnabled}" Icon="{DynamicResource Fluent.Ribbon.Images.QuickAccessToolbarExtender}" ToolTip="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.QuickAccessToolBarMoreControlsButtonTooltip, Mode=OneWay}" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
        <Fluent:DropDownButton.ContextMenu>
          <ContextMenu />
        </Fluent:DropDownButton.ContextMenu>
        <StackPanel Orientation="Horizontal" Background="{TemplateBinding Background}" Width="Auto" Height="26" Margin="-1">
          <StackPanel Orientation="Horizontal" x:Name="PART_ToolBarOverflowPanel" HorizontalAlignment="Left" Width="Auto" Height="Auto" VerticalAlignment="Center" Margin="1,0,0,0" />
          <ContentControl x:Name="popupContentControl" VerticalAlignment="Center" HorizontalAlignment="Left" Background="{x:Null}" Focusable="False" Padding="0" Margin="1,0" />
        </StackPanel>
      </Fluent:DropDownButton>
      <StackPanel Orientation="Horizontal" x:Name="PART_ToolBarPanel" Width="Auto" Height="Auto" VerticalAlignment="Stretch" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="1" />
    </DockPanel>
    <ControlTemplate.Triggers>
      <Trigger Property="CanQuickAccessLocationChanging" Value="False">
        <Setter Property="Visibility" TargetName="PART_ShowBelow" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ShowAbove" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="menuSeparator" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ShowAboveRibbon" Value="False">
        <Setter Property="Visibility" TargetName="PART_ShowBelow" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ShowAbove" Value="Visible" />
        <Setter Property="Icon" TargetName="PART_MenuDownButton" Value="{DynamicResource Fluent.Ribbon.Images.QuickAccessToolbarDropDown.BelowRibbon}" />
        <Setter Property="Icon" TargetName="PART_ToolbarDownButton" Value="{DynamicResource Fluent.Ribbon.Images.QuickAccessToolbarExtender.BelowRibbon}" />
      </Trigger>
      <Trigger Property="HasOverflowItems" Value="True">
        <Setter Property="Visibility" TargetName="PART_ToolbarDownButton" Value="Visible" />
        <Setter Property="Content" TargetName="popupContentControl" Value="{Binding ElementName=PART_MenuDownButton, Mode=OneWay}" />
        <Setter Property="Content" TargetName="menuContentControl" Value="{x:Null}" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="FluentPopupMenuControlTemplate" TargetType="{x:Type Fluent:ContextMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
      <Style TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
    </ControlTemplate.Resources>
    <Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
      <Border SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
          <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True" VerticalScrollBarVisibility="Auto">
              <StackPanel IsItemsHost="True" Orientation="Vertical" Margin="0" Width="Auto" Height="Auto" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top" />
            </ScrollViewer>
            <Border x:Name="resizeBorder" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="11" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BorderBrush}" BorderThickness="0,1,0,0" Grid.Row="1" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.Resize.BackgroundBrush}">
              <Grid>
                <Thumb x:Name="PART_ResizeVerticalThumb" HorizontalAlignment="Stretch" Margin="0,0,0,-90" Width="Auto" Height="10" VerticalAlignment="Top" Cursor="SizeNS" Template="{DynamicResource ResizeVerticalThumbControlTemplate}" />
                <Thumb x:Name="PART_ResizeBothThumb" HorizontalAlignment="Right" Margin="0,0,0,-90" Width="10" Height="10" VerticalAlignment="Top" Cursor="SizeNWSE" Template="{DynamicResource ResizeBothThumbControlTemplate}" />
              </Grid>
            </Border>
          </Grid>
        </Grid>
      </Border>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="FlowDirection" Value="RightToLeft">
        <Setter Property="Cursor" TargetName="PART_ResizeBothThumb" Value="SizeNESW" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="None">
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Collapsed" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Both">
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
      <Trigger Property="ResizeMode" Value="Vertical">
        <Setter Property="Visibility" TargetName="PART_ResizeBothThumb" Value="Collapsed" />
        <Setter Property="Visibility" TargetName="PART_ResizeVerticalThumb" Value="Visible" />
        <Setter Property="Visibility" TargetName="resizeBorder" Value="Visible" />
      </Trigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>
  <ControlTemplate x:Key="PopupMenuControlTemplate" TargetType="{x:Type ContextMenu}">
    <ControlTemplate.Resources>
      <Style BasedOn="{StaticResource MenuSeparatorStyle}" TargetType="{x:Type Separator}" />
      <Style TargetType="{x:Type Fluent:GroupSeparatorMenuItem}" BasedOn="{StaticResource MenuGroupSeparatorStyle}" />
    </ControlTemplate.Resources>
    <Grid Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
      <Border SnapsToDevicePixels="True" Background="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BorderBrush}" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid Width="Auto" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top">
          <Border VerticalAlignment="Stretch" Width="Auto" Height="Auto" BorderBrush="{DynamicResource Fluent.Ribbon.Brushes.DropDown.BackgroundBrush}" BorderThickness="1" />
          <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
            <Grid.RowDefinitions>
              <RowDefinition Height="*" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ScrollViewer x:Name="PART_ScrollViewer" Style="{DynamicResource MenuScrollViewer}" Margin="1" SnapsToDevicePixels="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
              <StackPanel Margin="0" Width="Auto" Height="Auto" IsItemsHost="True" Grid.RowSpan="1" x:Name="PART_ItemsHost" HorizontalAlignment="Left" VerticalAlignment="Top" />
            </ScrollViewer>
          </Grid>
        </Grid>
      </Border>
    </Grid>
  </ControlTemplate>
  <Style x:Key="StartScreenTabControlStyle" TargetType="{x:Type Fluent:StartScreenTabControl}" BasedOn="{StaticResource {x:Type Fluent:BackstageTabControl}}">
    <Setter Property="Template" Value="{DynamicResource StartScreenTabControlTemplate}" />
    <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:StartScreen}}, FallbackValue=Red}" />
    <Setter Property="Margin" Value="0" />
  </Style>
  <Style TargetType="{x:Type Fluent:StatusBarMenuItem}">
    <Setter Property="Template" Value="{DynamicResource RibbonStatusBarContextMenuItemControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="IsCheckable" Value="True" />
    <Setter Property="IsChecked" Value="{Binding StatusBarItem.IsChecked, RelativeSource={RelativeSource Self}, Mode=TwoWay}" />
  </Style>
  <Style x:Key="ZoomSliderStyle" TargetType="{x:Type Slider}">
    <Setter Property="Template" Value="{DynamicResource ZoomSliderControlTemplate}" />
    <Setter Property="Width" Value="133" />
    <Setter Property="Height" Value="16" />
    <Setter Property="Maximum" Value="500" />
    <Setter Property="Minimum" Value="10" />
    <Setter Property="SmallChange" Value="1" />
    <Setter Property="LargeChange" Value="10" />
    <Setter Property="Value" Value="100" />
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  </Style>
  <Style TargetType="{x:Type Fluent:StartScreenTabControl}" BasedOn="{StaticResource StartScreenTabControlStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonTabControl}" BasedOn="{StaticResource RibbonTabControlStyle}" />
  <Style x:Key="RibbonGroupBoxStyle" TargetType="{x:Type Fluent:RibbonGroupBox}">
    <Setter Property="Template" Value="{DynamicResource RibbonGroupBoxControlTemplate}" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Height" Value="Auto" />
    <Setter Property="HorizontalContentAlignment" Value="Left" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="Fluent:KeyTip.Margin" Value="0,15,0,0" />
    <Setter Property="HeaderTemplateSelector" Value="{Binding Source={x:Static templateSelectors:RibbonGroupBoxHeaderTemplateSelector.Instance}}" />
    <Style.Triggers>
      <Trigger Property="State" Value="QuickAccess">
        <Setter Property="Template" Value="{DynamicResource RibbonGroupBoxDropDownButtonControlTemplate}" />
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="22" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="SnapsToDevicePixels" Value="False" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="RibbonDropDownButtonStyle" TargetType="{x:Type Fluent:DropDownButton}">
    <Setter Property="Template" Value="{DynamicResource RibbonDropDownButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="32" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="RibbonSplitButtonStyle" TargetType="{x:Type Fluent:SplitButton}">
    <Setter Property="Template" Value="{DynamicResource RibbonSplitButtonControlTemplate}" />
    <Setter Property="Height" Value="68" />
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="SnapsToDevicePixels" Value="False" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="Fluent:KeyTip.AutoPlacement" Value="False" />
    <Style.Triggers>
      <Trigger Property="Size" Value="Large">
        <Setter Property="Height" Value="68" />
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Bottom" />
      </Trigger>
      <Trigger Property="Size" Value="Middle">
        <Setter Property="Height" Value="22" />
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Right" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.Margin" Value="0,0,-5,0" />
      </Trigger>
      <Trigger Property="Size" Value="Small">
        <Setter Property="Height" Value="22" />
        <Setter Property="Width" Value="32" />
        <Setter Property="Fluent:KeyTip.HorizontalAlignment" Value="Right" />
        <Setter Property="Fluent:KeyTip.VerticalAlignment" Value="Center" />
        <Setter Property="Fluent:KeyTip.Margin" Value="0,0,-5,0" />
      </Trigger>
    </Style.Triggers>
  </Style>
  <Style x:Key="QuickAccessToolbarStyle" TargetType="{x:Type Fluent:QuickAccessToolBar}">
    <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource AncestorType=Window}}" />
    <Setter Property="Template" Value="{DynamicResource QuickAccessToolbarControlTemplate}" />
  </Style>
  <Style x:Key="Fluent.Ribbon.Styles.ContextMenu" TargetType="{x:Type Fluent:ContextMenu}">
    <Setter Property="Template" Value="{DynamicResource FluentPopupMenuControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
  </Style>
  <Style x:Key="FluentRibbonDefaultContextMenuStyle" TargetType="{x:Type ContextMenu}">
    <Setter Property="Template" Value="{DynamicResource PopupMenuControlTemplate}" />
    <Setter Property="Foreground" Value="{DynamicResource Fluent.Ribbon.Brushes.LabelTextBrush}" />
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
  </Style>
  <Style TargetType="{x:Type Fluent:DropDownButton}" BasedOn="{StaticResource RibbonDropDownButtonStyle}" />
  <Style TargetType="{x:Type Fluent:SplitButton}" BasedOn="{StaticResource RibbonSplitButtonStyle}" />
  <Style TargetType="{x:Type Fluent:RibbonGroupBox}" BasedOn="{StaticResource RibbonGroupBoxStyle}" />
  <Style TargetType="{x:Type Fluent:ContextMenu}" BasedOn="{StaticResource Fluent.Ribbon.Styles.ContextMenu}" />
  <Style TargetType="{x:Type Fluent:QuickAccessToolBar}" BasedOn="{StaticResource QuickAccessToolbarStyle}" />
</ResourceDictionary>