<ResourceDictionary
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:CompileBindings="True">

    <ControlTheme x:Key="{x:Type SplitButton}" TargetType="SplitButton">
        <Setter Property="SplitButton.Background" Value="{DynamicResource ButtonDefaultBackground}" />
        <Setter Property="SplitButton.Foreground" Value="{DynamicResource ButtonDefaultPrimaryForeground}" />
        <Setter Property="SplitButton.BorderBrush" Value="{DynamicResource ButtonDefaultBorderBrush}" />
        <Setter Property="SplitButton.CornerRadius" Value="{DynamicResource ButtonCornerRadius}" />
        <Setter Property="SplitButton.BorderThickness" Value="{DynamicResource ButtonBorderThickness}" />
        <Setter Property="SplitButton.Padding" Value="{DynamicResource ButtonDefaultPadding}" />
        <Setter Property="SplitButton.RenderTransform" Value="none" />
        <Setter Property="SplitButton.FontSize" Value="{DynamicResource ButtonDefaultFontSize}" />
        <Setter Property="SplitButton.FontWeight" Value="{DynamicResource ButtonDefaultFontWeight}" />
        <Setter Property="SplitButton.HorizontalContentAlignment" Value="Center" />
        <Setter Property="SplitButton.VerticalContentAlignment" Value="Center" />
        <Setter Property="SplitButton.MinHeight" Value="12" />
        <Setter Property="Template">
            <ControlTemplate TargetType="SplitButton">
                <Grid ColumnDefinitions="*,Auto,Auto">
                    <Button
                        x:Name="PART_PrimaryButton"
                        Grid.Column="0"
                        Padding="{TemplateBinding Padding}"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Command="{TemplateBinding Command}"
                        CommandParameter="{TemplateBinding CommandParameter}"
                        Content="{TemplateBinding Content}"
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        CornerRadius="3 0 0 3"
                        Focusable="False"
                        FontFamily="{TemplateBinding FontFamily}"
                        FontSize="{TemplateBinding FontSize}"
                        FontWeight="{TemplateBinding FontWeight}"
                        Foreground="{TemplateBinding Foreground}"
                        KeyboardNavigation.IsTabStop="False" />

                    <Border
                        x:Name="SeparatorBorder"
                        Grid.Column="1"
                        Width="{DynamicResource SplitButtonSeparatorWidth}"
                        Background="Transparent"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="0.5" />

                    <Button
                        x:Name="PART_SecondaryButton"
                        Grid.Column="2"
                        Padding="4,0"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        HorizontalContentAlignment="Center"
                        VerticalContentAlignment="Center"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="0 3 3 0"
                        Focusable="False"
                        Foreground="{TemplateBinding Foreground}"
                        KeyboardNavigation.IsTabStop="False">
                        <PathIcon
                            Width="12"
                            Height="12"
                            Data="{DynamicResource SplitButtonIconGlyph}"
                            Foreground="{Binding $parent[Button].Foreground}" />
                    </Button>
                </Grid>
            </ControlTemplate>
        </Setter>


        <Style Selector="^.Secondary /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultSecondaryForeground}" />
        </Style>
        <Style Selector="^.Tertiary /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
        </Style>
        <Style Selector="^.Success /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultSuccessForeground}" />
        </Style>
        <Style Selector="^.Warning /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultWarningForeground}" />
        </Style>
        <Style Selector="^.Danger /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDangerForeground}" />
        </Style>
        <Style Selector="^:checked">
            <Style Selector="^ /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
            <Style Selector="^.Secondary /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
            <Style Selector="^.Tertiary /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
            <Style Selector="^.Success /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
            <Style Selector="^.Warning /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
            <Style Selector="^.Danger /template/ Button">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
                <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            </Style>
        </Style>
        <Style Selector="^.Large /template/ Button">
            <Setter Property="Padding" Value="{DynamicResource ButtonLargePadding}" />
        </Style>
        <Style Selector="^.Small /template/ Button">
            <Setter Property="Padding" Value="{DynamicResource ButtonSmallPadding}" />
        </Style>
        <Style Selector="^:disabled /template/ Button">
            <Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
        </Style>
    </ControlTheme>

    <ControlTheme
        x:Key="SolidSplitButton"
        BasedOn="{StaticResource {x:Type SplitButton}}"
        TargetType="SplitButton">
        <Setter Property="SplitButton.Foreground" Value="{DynamicResource ButtonSolidForeground}" />
        <Setter Property="SplitButton.Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
        <Style Selector="^ /template/ Button">
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
            </Style>
        </Style>

        <Style Selector="^.Primary /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidPrimaryPressedBackground}" />
            </Style>
        </Style>
        <Style Selector="^.Secondary /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSecondaryPressedBackground}" />
            </Style>
        </Style>
        <Style Selector="^.Tertiary /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidTertiaryPressedBackground}" />
            </Style>
        </Style>
        <Style Selector="^.Success /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidSuccessPressedBackground}" />
            </Style>
        </Style>
        <Style Selector="^.Warning /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidWarningBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidWarningPressedBackground}" />
            </Style>
        </Style>
        <Style Selector="^.Danger /template/ Button">
            <Setter Property="Foreground" Value="{DynamicResource ButtonSolidForeground}" />
            <Setter Property="Background" Value="{DynamicResource ButtonSolidDangerBackground}" />
            <Style Selector="^:pointerover">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPointeroverBackground}" />
            </Style>
            <Style Selector="^:pressed">
                <Setter Property="Background" Value="{DynamicResource ButtonSolidDangerPressedBackground}" />
            </Style>
        </Style>

        <Style Selector="^:disabled /template/ Button">
            <Setter Property="Background" Value="{DynamicResource ButtonDefaultDisabledBackground}" />
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
        </Style>
    </ControlTheme>

    <ControlTheme
        x:Key="BorderlessSplitButton"
        BasedOn="{StaticResource {x:Type SplitButton}}"
        TargetType="SplitButton">
        <Setter Property="SplitButton.Background" Value="Transparent" />
        <Setter Property="SplitButton.BorderBrush" Value="Transparent" />
        <Style Selector="^:disabled /template/ Button">
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" />
        </Style>
    </ControlTheme>
</ResourceDictionary>
