<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ModernWpf.Controls"
    xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives">

    <Style TargetType="primitives:TitleBarButton">
        <Setter Property="Background" Value="{DynamicResource TitleBarButtonBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
        <Setter Property="InactiveBackground" Value="{DynamicResource TitleBarButtonBackgroundInactive}" />
        <Setter Property="InactiveForeground" Value="{DynamicResource SystemControlDisabledBaseMediumLowBrush}" />
        <Setter Property="HoverBackground" Value="{DynamicResource SystemControlHighlightListLowBrush}" />
        <Setter Property="HoverForeground" Value="{DynamicResource SystemControlHighlightAltBaseHighBrush}" />
        <Setter Property="PressedBackground" Value="{DynamicResource SystemControlHighlightListMediumBrush}" />
        <Setter Property="PressedForeground" Value="{DynamicResource SystemControlHighlightAltBaseHighBrush}" />
        <Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" />
        <Setter Property="FontSize" Value="10" />
        <Setter Property="Height" Value="{DynamicResource {x:Static local:TitleBar.HeightKey}}" />
        <Setter Property="Width" Value="46" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="primitives:TitleBarButton">
                    <Grid
                        x:Name="RootGrid"
                        Background="{TemplateBinding Background}"
                        SnapsToDevicePixels="True">
                        <ContentPresenter
                            x:Name="Content"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            Margin="{TemplateBinding Padding}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsActive" Value="False">
                            <Setter Property="Background" TargetName="RootGrid" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InactiveBackground}" />
                            <Setter Property="TextElement.Foreground" TargetName="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InactiveForeground}" />
                        </Trigger>
                        <Trigger Property="IsMouseReallyOver" Value="true">
                            <Setter Property="Background" TargetName="RootGrid" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HoverBackground}" />
                            <Setter Property="TextElement.Foreground" TargetName="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HoverForeground}" />
                        </Trigger>
                        <Trigger Property="IsReallyPressed" Value="true">
                            <Setter Property="Background" TargetName="RootGrid" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PressedBackground}" />
                            <Setter Property="TextElement.Foreground" TargetName="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PressedForeground}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="RootGrid" Value="{DynamicResource SystemControlDisabledTransparentBrush}" />
                            <Setter Property="TextElement.Foreground" TargetName="Content" Value="{DynamicResource SystemControlDisabledBaseMediumLowBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>