<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Fluent="clr-namespace:Fluent">
    <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>

    <!--Menu Item 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>

    <!--Menu Item Template-->
    <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>
</ResourceDictionary>
