<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:System="clr-namespace:System;assembly=mscorlib">

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