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

  <Design.PreviewWith>
    <Border Padding="20">
      <StackPanel Spacing="20">
        <DropDownButton Content="Click Me!" />
        <DropDownButton Content="Disabled" IsEnabled="False" />
      </StackPanel>
    </Border>
  </Design.PreviewWith>

  <Styles.Resources>
    <x:Double x:Key="DropDownButtonMinHeight">32</x:Double>
  </Styles.Resources>
  
  <Style Selector="DropDownButton">
    <Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
    <Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
    <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrush}" />
    <Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThemeThickness}" />
    <Setter Property="Padding" Value="{DynamicResource ButtonPadding}" />
    <Setter Property="MinHeight" Value="{DynamicResource DropDownButtonMinHeight}" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Center" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <!--<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
    <Setter Property="FocusVisualMargin" Value="-3" />-->
    <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate>
          <Border x:Name="RootBorder"
                  Background="{TemplateBinding Background}"
                  BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}"
                  CornerRadius="{TemplateBinding CornerRadius}"
                  ClipToBounds="True">
            <Grid x:Name="InnerGrid">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>

              <ContentPresenter x:Name="PART_ContentPresenter"
                                Grid.Column="0"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Padding="{TemplateBinding Padding}"
                                RecognizesAccessKey="True"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />

              <PathIcon x:Name="DropDownGlyph"
                        Grid.Column="1"
                        UseLayoutRounding="False"
                        IsHitTestVisible="False"
                        Height="12"
                        Width="12"
                        Margin="0,0,10,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center" />

            </Grid>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!--  Normal State  -->
  <Style Selector="DropDownButton /template/ PathIcon#DropDownGlyph">
    <Setter Property="Foreground" Value="{DynamicResource ComboBoxDropDownGlyphForeground}" />
    <Setter Property="Data" Value="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z" />
  </Style>

  <!--  PointerOver State  -->
  <Style Selector="DropDownButton:pointerover /template/ Border#RootBorder">
    <Setter Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
    <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
    <Setter Property="TextElement.Foreground" Value="{DynamicResource ButtonForegroundPointerOver}" />
  </Style>

  <!--  Pressed State  -->
  <Style Selector="DropDownButton:pressed  /template/ Border#RootBorder">
    <Setter Property="Background" Value="{DynamicResource ButtonBackgroundPressed}" />
    <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
    <Setter Property="TextElement.Foreground" Value="{DynamicResource ButtonForegroundPressed}" />
  </Style>

  <!--  Disabled State  -->
  <Style Selector="DropDownButton:disabled /template/ Border#RootBorder">
    <Setter Property="Background" Value="{DynamicResource ButtonBackgroundDisabled}" />
    <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushDisabled}" />
    <Setter Property="TextElement.Foreground" Value="{DynamicResource ButtonForegroundDisabled}" />
  </Style>
  <Style Selector="DropDownButton:disabled /template/ PathIcon#DropDownGlyph">
    <Setter Property="Foreground" Value="{DynamicResource ButtonForegroundDisabled}" />
  </Style>

</Styles>
