<Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Design.PreviewWith>
    <Border Padding="20">
      <StackPanel Spacing="10">
        <ComboBox PlaceholderText="Select an item">
          <ComboBoxItem>Item 1</ComboBoxItem>
          <ComboBoxItem>Item 2</ComboBoxItem>
        </ComboBox>
        <ComboBox IsEnabled="False"
                  Width="200"
                  SelectedIndex="1"
                  HorizontalContentAlignment="Center">
          <ComboBoxItem>Item 1</ComboBoxItem>
          <ComboBoxItem>Item 2</ComboBoxItem>
        </ComboBox>
      </StackPanel>
    </Border>
  </Design.PreviewWith>
  <Style Selector="ComboBox">
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
    <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="4" />
    <Setter Property="MinHeight" Value="20" />
    <Setter Property="PlaceholderForeground" Value="{DynamicResource ThemeForegroundBrush}" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    <Setter Property="Template">
      <ControlTemplate>
        <Border Name="border"
                Background="{TemplateBinding Background}"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                CornerRadius="{TemplateBinding CornerRadius}">
          <Grid ColumnDefinitions="*,Auto">
            <TextBlock Name="PlaceholderTextBlock"
                       Grid.Column="0"
                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                       Margin="{TemplateBinding Padding}"
                       Text="{TemplateBinding PlaceholderText}"
                       Foreground="{TemplateBinding PlaceholderForeground}"
                       IsVisible="{TemplateBinding SelectionBoxItem, Converter={x:Static ObjectConverters.IsNull}}" />
            <ContentControl Content="{TemplateBinding SelectionBoxItem}"
                            ContentTemplate="{TemplateBinding ItemTemplate}"
                            Margin="{TemplateBinding Padding}"
                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
            <ToggleButton Name="toggle"
                          BorderThickness="0"
                          Background="Transparent"
                          ClickMode="Press"
                          Focusable="False"
                          IsChecked="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
                          Grid.Column="1">
              <Path Fill="{DynamicResource ThemeForegroundBrush}"
                    Width="8"
                    Height="4"
                    Stretch="Uniform"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z" />
            </ToggleButton>
            <Popup Name="PART_Popup"
                   IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
                   MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
                   MaxHeight="{TemplateBinding MaxDropDownHeight}"
                   PlacementTarget="{TemplateBinding}"
                   IsLightDismissEnabled="True">
              <Border Background="{DynamicResource ThemeBackgroundBrush}"
                      BorderBrush="{DynamicResource ThemeBorderMidBrush}"                      
                      BorderThickness="1">
                <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                              VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
                  <ItemsPresenter Name="PART_ItemsPresenter"
                                  Items="{TemplateBinding Items}"
                                  ItemsPanel="{TemplateBinding ItemsPanel}"
                                  ItemTemplate="{TemplateBinding ItemTemplate}"
                                  VirtualizationMode="{TemplateBinding VirtualizationMode}" />
                </ScrollViewer>
              </Border>
            </Popup>
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="ComboBox:pointerover /template/ Border#border">
    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
  </Style>
  <Style Selector="ComboBox:disabled /template/ Border#border">
    <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
  </Style>
</Styles>
