<Styles xmlns="https://github.com/avaloniaui">

  <Style Selector="Expander">
    <Setter Property="ContentTransition">
      <Setter.Value>
        <CrossFade Duration="00:00:00.25" />
      </Setter.Value>
    </Setter>
  </Style>
  <Style Selector="Expander[ExpandDirection=Down]">
    <Setter Property="Template">
      <ControlTemplate>
        <Border Background="{TemplateBinding Background}">
          <Grid RowDefinitions="Auto,*">
            <ToggleButton Name="PART_toggle" Grid.Row="0"  Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
            <ContentPresenter Name="PART_ContentPresenter"
                              Grid.Row="1"
                              IsVisible="{TemplateBinding IsExpanded}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Content="{TemplateBinding Content}"
                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                              Padding="{TemplateBinding Padding}" />
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="Expander[ExpandDirection=Up]">
    <Setter Property="Template">
      <ControlTemplate>
        <Border Background="{TemplateBinding Background}">
          <Grid RowDefinitions="*,Auto">
            <ToggleButton Name="PART_toggle" Grid.Row="1"  Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
            <ContentPresenter Name="PART_ContentPresenter"
                              Grid.Row="0"
                              IsVisible="{TemplateBinding IsExpanded}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Content="{TemplateBinding Content}"
                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                              Padding="{TemplateBinding Padding}" />
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="Expander[ExpandDirection=Right]">
    <Setter Property="Template">
      <ControlTemplate>
        <Border Background="{TemplateBinding Background}">
          <Grid ColumnDefinitions="Auto,*">
            <ToggleButton Name="PART_toggle" Grid.Column="0"  Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
            <ContentPresenter Name="PART_ContentPresenter"
                              Grid.Column="1"
                              IsVisible="{TemplateBinding IsExpanded}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Content="{TemplateBinding Content}"
                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                              Padding="{TemplateBinding Padding}" />
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="Expander[ExpandDirection=Left]">
    <Setter Property="Template">
      <ControlTemplate>
        <Border Background="{TemplateBinding Background}">
          <Grid ColumnDefinitions="*,Auto">
            <ToggleButton Name="PART_toggle" Grid.Column="1"  Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" />
            <ContentPresenter Name="PART_ContentPresenter"
                              Grid.Column="0"
                              IsVisible="{TemplateBinding IsExpanded}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              Content="{TemplateBinding Content}"
                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                              Padding="{TemplateBinding Padding}" />
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="Expander /template/ ToggleButton#PART_toggle">
    <Setter Property="Template">
      <ControlTemplate>
        <Border BorderThickness="1">
          <Grid ColumnDefinitions="Auto,Auto">
            <Border Grid.Column="0" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center">
              <Path Fill="{DynamicResource ThemeForegroundBrush}"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center"
                      Data="M 0 2 L 4 6 L 0 10 Z" />
            </Border>
            <ContentPresenter Name="PART_ContentPresenter"
                              Grid.Column="1" 
                              Background="Transparent" 
                              Content="{TemplateBinding Content}" 
                              VerticalAlignment="Center" 
                              HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                              Padding="{TemplateBinding Padding}"/>
          </Grid>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
  <Style Selector="Expander /template/ ToggleButton#PART_toggle:pointerover /template/ Border">
    <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}" />
  </Style>
  <Style Selector="Expander:down:expanded /template/ ToggleButton#PART_toggle /template/ Path">
    <Setter Property="RenderTransform">
      <RotateTransform Angle="90" />
    </Setter>
  </Style>
  <Style Selector="Expander:up:expanded /template/ ToggleButton#PART_toggle /template/ Path">
    <Setter Property="RenderTransform">
      <RotateTransform Angle="-90" />
    </Setter>
  </Style>
  <Style Selector="Expander:left:expanded /template/ ToggleButton#PART_toggle /template/ Path">
    <Setter Property="RenderTransform">
      <RotateTransform Angle="180" />
    </Setter>
  </Style>
  <Style Selector="Expander:right /template/ ToggleButton#PART_toggle /template/ Path">
    <Setter Property="RenderTransform">
      <RotateTransform Angle="180" />
    </Setter>
  </Style>
  <Style Selector="Expander:right:expanded /template/ ToggleButton#PART_toggle /template/ Path">
    <Setter Property="RenderTransform">
      <RotateTransform Angle="0" />
    </Setter>
  </Style>
</Styles>
