text: ﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  
      <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type ToggleButton}">
                      <Border Padding="{TemplateBinding Padding}">
                          <Grid Background="Transparent" SnapsToDevicePixels="False">
                              <Grid.RowDefinitions>
                                  <RowDefinition Height="19" />
                                  <RowDefinition Height="*" />
                              </Grid.RowDefinitions>
                              <Grid>
                                  <Grid.LayoutTransform>
                                      <TransformGroup>
                                          <TransformGroup.Children>
                                              <TransformCollection>
                                                  <RotateTransform Angle="-90" />
                                              </TransformCollection>
                                          </TransformGroup.Children>
                                      </TransformGroup>
                                  </Grid.LayoutTransform>
                                  <Ellipse x:Name="circle" Width="19" Height="19"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"
                                           Fill="{DynamicResource Expander.Static.Circle.Fill}"
                                           Stroke="{DynamicResource Expander.Static.Circle.Stroke}" />
                                  <Path x:Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
                                        Data="M 1,1.5 L 4.5,5 L 8,1.5" SnapsToDevicePixels="false"
                                        Stroke="{DynamicResource Expander.Static.Arrow.Stroke}"
                                        StrokeThickness="2" />
                              </Grid>
                              <ContentPresenter Grid.Row="1" Margin="0,4,0,0" HorizontalAlignment="Center"
                                                VerticalAlignment="Top" RecognizesAccessKey="True" SnapsToDevicePixels="True" />
                          </Grid>
                      </Border>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsChecked" Value="true">
                              <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5" />
                          </Trigger>
                          <Trigger Property="IsMouseOver" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.MouseOver.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsPressed" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Pressed.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Pressed.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Pressed.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="false">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Disabled.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Disabled.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Disabled.Arrow.Stroke}" />
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
  
      <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type ToggleButton}">
                      <Border Padding="{TemplateBinding Padding}">
                          <Grid Background="Transparent" SnapsToDevicePixels="False">
                              <Grid.ColumnDefinitions>
                                  <ColumnDefinition Width="19" />
                                  <ColumnDefinition Width="*" />
                              </Grid.ColumnDefinitions>
                              <Grid>
                                  <Grid.LayoutTransform>
                                      <TransformGroup>
                                          <TransformGroup.Children>
                                              <TransformCollection>
                                                  <RotateTransform Angle="180" />
                                              </TransformCollection>
                                          </TransformGroup.Children>
                                      </TransformGroup>
                                  </Grid.LayoutTransform>
                                  <Ellipse x:Name="circle" Width="19" Height="19"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"
                                           Fill="{DynamicResource Expander.Static.Circle.Fill}"
                                           Stroke="{DynamicResource Expander.Static.Circle.Stroke}" />
                                  <Path x:Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
                                        Data="M 1,1.5 L 4.5,5 L 8,1.5" SnapsToDevicePixels="false"
                                        Stroke="{DynamicResource Expander.Static.Arrow.Stroke}"
                                        StrokeThickness="2" />
                              </Grid>
                              <ContentPresenter Grid.Column="1" Margin="4,0,0,0" HorizontalAlignment="Left"
                                                VerticalAlignment="Center" RecognizesAccessKey="True" SnapsToDevicePixels="True" />
                          </Grid>
                      </Border>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsChecked" Value="true">
                              <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5" />
                          </Trigger>
                          <Trigger Property="IsMouseOver" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.MouseOver.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsPressed" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Pressed.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Pressed.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Pressed.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="false">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Disabled.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Disabled.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Disabled.Arrow.Stroke}" />
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
  
      <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type ToggleButton}">
                      <Border Padding="{TemplateBinding Padding}">
                          <Grid Background="Transparent" SnapsToDevicePixels="False">
                              <Grid.RowDefinitions>
                                  <RowDefinition Height="19" />
                                  <RowDefinition Height="*" />
                              </Grid.RowDefinitions>
                              <Grid>
                                  <Grid.LayoutTransform>
                                      <TransformGroup>
                                          <TransformGroup.Children>
                                              <TransformCollection>
                                                  <RotateTransform Angle="90" />
                                              </TransformCollection>
                                          </TransformGroup.Children>
                                      </TransformGroup>
                                  </Grid.LayoutTransform>
                                  <Ellipse x:Name="circle" Width="19" Height="19"
                                           HorizontalAlignment="Center" VerticalAlignment="Center"
                                           Fill="{DynamicResource Expander.Static.Circle.Fill}"
                                           Stroke="{DynamicResource Expander.Static.Circle.Stroke}" />
                                  <Path x:Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
                                        Data="M 1,1.5 L 4.5,5 L 8,1.5" SnapsToDevicePixels="false"
                                        Stroke="{DynamicResource Expander.Static.Arrow.Stroke}"
                                        StrokeThickness="2" />
                              </Grid>
                              <ContentPresenter Grid.Row="1" Margin="0,4,0,0" HorizontalAlignment="Center"
                                                VerticalAlignment="Top" RecognizesAccessKey="True" SnapsToDevicePixels="True" />
                          </Grid>
                      </Border>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsChecked" Value="true">
                              <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5" />
                          </Trigger>
                          <Trigger Property="IsMouseOver" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.MouseOver.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsPressed" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Pressed.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Pressed.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Pressed.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="false">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Disabled.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Disabled.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Disabled.Arrow.Stroke}" />
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
  
      <Style x:Key="ExpanderHeaderFocusVisual">
          <Setter Property="Control.Template">
              <Setter.Value>
                  <ControlTemplate>
                      <Border>
                          <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black"
                                     StrokeThickness="1" StrokeDashArray="1 2" />
                      </Border>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
      <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type ToggleButton}">
                      <Border Padding="{TemplateBinding Padding}">
                          <Grid Background="Transparent" SnapsToDevicePixels="False">
                              <Grid.ColumnDefinitions>
                                  <ColumnDefinition Width="19" />
                                  <ColumnDefinition Width="*" />
                              </Grid.ColumnDefinitions>
                              <Ellipse x:Name="circle" Width="19" Height="19"
                                       HorizontalAlignment="Center" VerticalAlignment="Center"
                                       Fill="{DynamicResource Expander.Static.Circle.Fill}"
                                       Stroke="{DynamicResource Expander.Static.Circle.Stroke}" />
                              <Path x:Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center"
                                    Data="M 1,1.5 L 4.5,5 L 8,1.5" SnapsToDevicePixels="false"
                                    Stroke="{DynamicResource Expander.Static.Arrow.Stroke}"
                                    StrokeThickness="2" />
                              <ContentPresenter Grid.Column="1" Margin="4,0,0,0" HorizontalAlignment="Left"
                                                VerticalAlignment="Center" RecognizesAccessKey="True" SnapsToDevicePixels="True" />
                          </Grid>
                      </Border>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsChecked" Value="true">
                              <Setter TargetName="arrow" Property="Data" Value="M 1,4.5  L 4.5,1  L 8,4.5" />
                          </Trigger>
                          <Trigger Property="IsMouseOver" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.MouseOver.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.MouseOver.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsPressed" Value="true">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Pressed.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Pressed.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Pressed.Arrow.Stroke}" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="false">
                              <Setter TargetName="circle" Property="Stroke" Value="{DynamicResource Expander.Disabled.Circle.Stroke}" />
                              <Setter TargetName="circle" Property="Fill" Value="{DynamicResource Expander.Disabled.Circle.Fill}" />
                              <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Expander.Disabled.Arrow.Stroke}" />
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
  
      <Style TargetType="{x:Type Expander}">
          <Setter Property="Foreground" Value="{DynamicResource Control.Foreground}" />
          <Setter Property="Background" Value="Transparent" />
          <Setter Property="HorizontalContentAlignment" Value="Stretch" />
          <Setter Property="VerticalContentAlignment" Value="Stretch" />
          <Setter Property="BorderBrush" Value="Transparent" />
          <Setter Property="BorderThickness" Value="1" />
          <Setter Property="Template">
              <Setter.Value>
                  <ControlTemplate TargetType="{x:Type Expander}">
                      <Border BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"
                              Background="{TemplateBinding Background}"
                              CornerRadius="3" SnapsToDevicePixels="true">
                          <DockPanel>
                              <ToggleButton x:Name="HeaderSite" MinWidth="0" MinHeight="0"
                                            Margin="1"
                                            Padding="{TemplateBinding Padding}"
                                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                                            ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                            Content="{TemplateBinding Header}"
                                            DockPanel.Dock="Top"
                                            Foreground="{TemplateBinding Foreground}"
                                            FontWeight="{TemplateBinding FontWeight}"
                                            FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
                                            FontStyle="{TemplateBinding FontStyle}"
                                            FontStretch="{TemplateBinding FontStretch}"
                                            FontSize="{TemplateBinding FontSize}"
                                            FontFamily="{TemplateBinding FontFamily}"
                                            IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                            Style="{StaticResource ExpanderDownHeaderStyle}" />
                              <ContentPresenter x:Name="ExpandSite"
                                                Margin="{TemplateBinding Padding}"
                                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                DockPanel.Dock="Bottom" Focusable="false" Visibility="Collapsed" />
                          </DockPanel>
                      </Border>
                      <ControlTemplate.Triggers>
                          <Trigger Property="IsExpanded" Value="true">
                              <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
                          </Trigger>
                          <Trigger Property="ExpandDirection" Value="Right">
                              <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
                              <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
                              <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
                          </Trigger>
                          <Trigger Property="ExpandDirection" Value="Up">
                              <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
                              <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
                              <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}" />
                          </Trigger>
                          <Trigger Property="ExpandDirection" Value="Left">
                              <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
                              <Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
                              <Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
                          </Trigger>
                          <Trigger Property="IsEnabled" Value="false">
                              <Setter Property="Foreground" Value="{DynamicResource Control.GrayText}" />
                          </Trigger>
                      </ControlTemplate.Triggers>
                  </ControlTemplate>
              </Setter.Value>
          </Setter>
      </Style>
  
  
  </ResourceDictionary>