<ResourceDictionary
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:CompileBindings="True">
    <Design.PreviewWith>
        <StackPanel Margin="20">
            <ToggleButton Classes="Primary">Toggle</ToggleButton>
            <ToggleButton Classes="Secondary">Toggle</ToggleButton>
            <ToggleButton Classes="Tertiary">Toggle</ToggleButton>
            <ToggleButton Classes="Success">Toggle</ToggleButton>
            <ToggleButton Classes="Warning">Toggle</ToggleButton>
            <ToggleButton Classes="Danger">Toggle</ToggleButton>

            <ToggleButton Classes="Primary" IsThreeState="True">Toggle 3</ToggleButton>
            <ToggleButton Classes="Secondary" IsThreeState="True">Toggle 3</ToggleButton>
            <ToggleButton Classes="Tertiary" IsThreeState="True">Toggle 3</ToggleButton>
            <ToggleButton Classes="Success" IsThreeState="True">Toggle 3</ToggleButton>
            <ToggleButton Classes="Warning" IsThreeState="True">Toggle 3</ToggleButton>
            <ToggleButton Classes="Danger" IsThreeState="True">Toggle 3</ToggleButton>
        </StackPanel>
    </Design.PreviewWith>
    <ControlTheme x:Key="{x:Type ToggleButton}" TargetType="ToggleButton">
        <Setter Property="ToggleButton.Background" Value="{DynamicResource ToggleButtonDefaultBackground}" />
        <Setter Property="ToggleButton.Foreground" Value="{DynamicResource ToggleButtonDefaultPrimaryForeground}" />
        <Setter Property="ToggleButton.BorderBrush" Value="{DynamicResource ToggleButtonDefaultBorderBrush}" />
        <Setter Property="ToggleButton.CornerRadius" Value="{DynamicResource ToggleButtonCornerRadius}" />
        <Setter Property="ToggleButton.BorderThickness" Value="{DynamicResource ToggleButtonBorderThickness}" />
        <Setter Property="ToggleButton.Padding" Value="{DynamicResource ToggleButtonDefaultPadding}" />
        <Setter Property="ToggleButton.RenderTransform" Value="none" />
        <Setter Property="ToggleButton.FontSize" Value="{DynamicResource ToggleButtonDefaultFontSize}" />
        <Setter Property="ToggleButton.FontWeight" Value="{DynamicResource ToggleButtonDefaultFontWeight}" />
        <Setter Property="ToggleButton.HorizontalContentAlignment" Value="Center" />
        <Setter Property="ToggleButton.VerticalContentAlignment" Value="Center" />
        <Setter Property="ToggleButton.MinHeight" Value="12" />
        <Setter Property="ToggleButton.Cursor" Value="Hand" />
        <Setter Property="ToggleButton.Template">
            <ControlTemplate TargetType="ToggleButton">
                <ContentPresenter
                    x:Name="PART_ContentPresenter"
                    Padding="{TemplateBinding Padding}"
                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Content="{TemplateBinding Content}"
                    ContentTemplate="{TemplateBinding ContentTemplate}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    RecognizesAccessKey="True"
                    TextElement.FontSize="{TemplateBinding FontSize}"
                    TextElement.FontWeight="{TemplateBinding FontWeight}"
                    UseLayoutRounding="False" />
            </ControlTemplate>
        </Setter>

        <Style Selector="^:pressed">
            <Setter Property="RenderTransform" Value="scale(0.98)" />
        </Style>

        <Style Selector="^:pointerover">
            <Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultPointeroverBackground}" />
        </Style>

        <Style Selector="^:pressed">
            <Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultPressedBackground}" />
        </Style>

        <Style Selector="^:disabled">
            <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
        </Style>

        <Style Selector="^.Primary">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultPrimaryForeground}" />
        </Style>
        <Style Selector="^.Secondary">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultSecondaryForeground}" />
        </Style>
        <Style Selector="^.Tertiary">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultTertiaryForeground}" />
        </Style>
        <Style Selector="^.Success">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultSuccessForeground}" />
        </Style>
        <Style Selector="^.Warning">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultWarningForeground}" />
        </Style>
        <Style Selector="^.Danger">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDangerForeground}" />
        </Style>

        <Style Selector="^:checked">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonCheckedForeground}" />
            <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
            <Style Selector="^.Primary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedBackground}" />
            </Style>
            <Style Selector="^.Secondary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedBackground}" />
            </Style>
            <Style Selector="^.Tertiary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedBackground}" />
            </Style>
            <Style Selector="^.Success">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedBackground}" />
            </Style>
            <Style Selector="^.Warning">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedBackground}" />
            </Style>
            <Style Selector="^.Danger">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedBackground}" />
            </Style>
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPointeroverBackground}" />
                <Style Selector="^.Primary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPointeroverBackground}" />
                </Style>
                <Style Selector="^.Secondary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedPointeroverBackground}" />
                </Style>
                <Style Selector="^.Tertiary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedPointeroverBackground}" />
                </Style>
                <Style Selector="^.Success">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedPointeroverBackground}" />
                </Style>
                <Style Selector="^.Warning">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedPointeroverBackground}" />
                </Style>
                <Style Selector="^.Danger">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedPointeroverBackground}" />
                </Style>
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBackground}" />
                <Style Selector="^.Primary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryCheckedPressedBackground}" />
                </Style>
                <Style Selector="^.Secondary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryCheckedPressedBackground}" />
                </Style>
                <Style Selector="^.Tertiary">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryCheckedPressedBackground}" />
                </Style>
                <Style Selector="^.Success">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessCheckedPressedBackground}" />
                </Style>
                <Style Selector="^.Warning">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonWarningCheckedPressedBackground}" />
                </Style>
                <Style Selector="^.Danger">
                    <Setter Property="Background" Value="{DynamicResource ToggleButtonDangerCheckedPressedBackground}" />
                </Style>
            </Style>
            <Style Selector="^:disabled">
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDefaultDisabledBorderBrush}" />
            </Style>
        </Style>

        <Style Selector="^:indeterminate">
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
            <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBackground}" />
            <Style Selector="^.Primary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^.Secondary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonSecondaryIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^.Tertiary">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonTertiaryIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^.Success">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonSuccessIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^.Warning">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonWarningIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^.Danger">
                <Setter Property="Background" Value="{DynamicResource ToggleButtonDangerIndeterminateBackground}" />
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminateBorderBrush}" />
            </Style>
            <Style Selector="^:pointerover">
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverBorderBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverForeground}" />
                <Style Selector="^.Primary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePointeroverForeground}" />
                </Style>
                <Style Selector="^.Secondary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePointeroverForeground}" />
                </Style>
                <Style Selector="^.Tertiary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePointeroverForeground}" />
                </Style>
                <Style Selector="^.Success">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonSuccessIndeterminatePointeroverForeground}" />
                </Style>
                <Style Selector="^.Warning">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonWarningIndeterminatePointeroverForeground}" />
                </Style>
                <Style Selector="^.Danger">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminatePointeroverBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDangerIndeterminatePointeroverForeground}" />
                </Style>
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
                <Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
                <Style Selector="^.Primary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonPrimaryIndeterminatePressedForeground}" />
                </Style>
                <Style Selector="^.Secondary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonSecondaryIndeterminatePressedForeground}" />
                </Style>
                <Style Selector="^.Tertiary">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonTertiaryIndeterminatePressedForeground}" />
                </Style>
                <Style Selector="^.Success">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonSuccessIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonSuccessIndeterminatePressedForeground}" />
                </Style>
                <Style Selector="^.Warning">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonWarningIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonWarningIndeterminatePressedForeground}" />
                </Style>
                <Style Selector="^.Danger">
                    <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonDangerIndeterminatePressedBorderBrush}" />
                    <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDangerIndeterminatePressedForeground}" />
                </Style>
            </Style>
            <Style Selector="^:disabled">
                <Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonIndeterminateDisabledBorderBrush}" />
            </Style>
        </Style>

        <Style Selector="^:disabled">
            <Setter Property="Foreground" Value="{DynamicResource ToggleButtonDefaultDisabledForeground}" />
            <Setter Property="Background" Value="{DynamicResource ToggleButtonDefaultDisabledBackground}" />
        </Style>

        <Style Selector="^.Large">
            <Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
        </Style>
        <Style Selector="^.Small">
            <Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
        </Style>
    </ControlTheme>
</ResourceDictionary>
