<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<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 x:Key="DefaultToggleButtonStyle" TargetType="ToggleButton">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource ToggleButtonBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource ToggleButtonForeground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource ToggleButtonBorderThemeThickness}" />
        <Setter Property="Padding" Value="{DynamicResource ButtonPadding}" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
        <Setter Property="primitives:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
        <Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
        <Setter Property="primitives:FocusVisualHelper.UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" />
        <Setter Property="primitives:FocusVisualHelper.FocusVisualMargin" Value="-3" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <local:ContentControlEx
                        x:Name="ContentPresenter"
                        Background="{TemplateBinding Background}"
                        Foreground="{TemplateBinding Foreground}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Content="{TemplateBinding Content}"
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                        ContentStringFormat="{TemplateBinding ContentStringFormat}"
                        CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}"
                        Padding="{TemplateBinding Padding}"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        RecognizesAccessKey="True"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <!-- TODO
                            <contract7Present:ContentPresenter.BackgroundTransition>
                                <contract7Present:BrushTransition Duration="0:0:0.083" />
                            </contract7Present:ContentPresenter.BackgroundTransition>
                            -->
                    </local:ContentControlEx>
                    <ControlTemplate.Triggers>
                        <!-- PointerOver -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="False" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundPointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundPointerOver}" />
                        </MultiTrigger>
                        <!-- Pressed -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="False" />
                                <Condition Property="IsPressed" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundPressed}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPressed}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundPressed}" />
                        </MultiTrigger>
                        <!-- Disabled -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="False" />
                                <Condition Property="IsEnabled" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushDisabled}" />
                        </MultiTrigger>
                        <!-- Checked -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="True" />
                                <Condition Property="IsMouseOver" Value="False" />
                                <Condition Property="IsPressed" Value="False" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundChecked}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundChecked}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushChecked}" />
                            <!--<Setter TargetName="ContentPresenter" Property="BackgroundSizing" Value="OuterBorderEdge" />-->
                        </MultiTrigger>
                        <!-- CheckedPointerOver -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="True" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPointerOver}" />
                            <!--<Setter TargetName="ContentPresenter" Property="BackgroundSizing" Value="OuterBorderEdge" />-->
                        </MultiTrigger>
                        <!-- CheckedPressed -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="True" />
                                <Condition Property="IsPressed" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPressed}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPressed}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPressed}" />
                            <!--<Setter TargetName="ContentPresenter" Property="BackgroundSizing" Value="OuterBorderEdge" />-->
                        </MultiTrigger>
                        <!-- CheckedDisabled -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="True" />
                                <Condition Property="IsEnabled" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedDisabled}" />
                        </MultiTrigger>
                        <!-- Indeterminate -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="{x:Null}" />
                                <Condition Property="IsMouseOver" Value="False" />
                                <Condition Property="IsPressed" Value="False" />
                                <Condition Property="IsEnabled" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminate}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminate}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminate}" />
                        </MultiTrigger>
                        <!-- IndeterminatePointerOver -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="{x:Null}" />
                                <Condition Property="IsMouseOver" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePointerOver}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePointerOver}" />
                        </MultiTrigger>
                        <!-- IndeterminatePressed -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="{x:Null}" />
                                <Condition Property="IsPressed" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePressed}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePressed}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePressed}" />
                        </MultiTrigger>
                        <!-- IndeterminateDisabled -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsChecked" Value="{x:Null}" />
                                <Condition Property="IsEnabled" Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminateDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminateDisabled}" />
                            <Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminateDisabled}" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ToggleButton" BasedOn="{StaticResource DefaultToggleButtonStyle}" />

</ResourceDictionary>