<ResourceDictionary
   x:Class="EgtDictionary"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:Project="clr-namespace:OmagCUT"
   xmlns:ControlExtensions="clr-namespace:OmagCUT.ControlExtensions">

   <!--Template che permette di andare a capo-->
   <DataTemplate x:Key="Button_DataTemplate_Wrap">
      <TextBlock TextWrapping="Wrap" Text="{Binding}"/>
   </DataTemplate>

   <!--ButtonBase-->
   <Style TargetType="{x:Type Button}">
      <Setter Property="FocusVisualStyle">
         <Setter.Value>
            <Style>
               <Setter Property="Control.Template">
                  <Setter.Value>
                     <ControlTemplate>
                        <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                     </ControlTemplate>
                  </Setter.Value>
               </Setter>
            </Style>
         </Setter.Value>
      </Setter>
      <Setter Property="Background" Value="#FFDDDDDD"/>
      <Setter Property="BorderBrush" Value="#FF707070"/>
      <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
      <Setter Property="BorderThickness" Value="1"/>
      <Setter Property="HorizontalContentAlignment" Value="Center"/>
      <Setter Property="VerticalContentAlignment" Value="Center"/>
      <Setter Property="Padding" Value="1"/>

      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}" >
               <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Project:ButtonExtensions.CornerRadius)}"
                  Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                  <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
               </Border>
               <ControlTemplate.Triggers>
                  <Trigger Property="IsDefaulted" Value="True">
                     <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                  </Trigger>
                  <!--Commentato per evitare che cambi colore quando ci si passa sopra con il mouse-->
                  <!--<Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFBEE6FD"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
                  </Trigger>-->
                  <!--Commentato per evitare che cambi colore quando viene premuto-->
                  <!--<Trigger Property="IsPressed" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFC4E5F6"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
                  </Trigger>-->
                  <Trigger Property="ToggleButton.IsChecked" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
                  </Trigger>
                  <Trigger Property="IsEnabled" Value="False">
                     <Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
                     <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF838383"/>
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--Template che permette di andare a capo-->
   <DataTemplate x:Key="CheckBox_DataTemplate_Wrap">
      <TextBlock TextWrapping="Wrap" Text="{Binding}" />
   </DataTemplate>

   <!--Riferimento al Converter che permette di ridimensionare la spunta-->
   <ControlExtensions:CheckboxConverter x:Key="converter"></ControlExtensions:CheckboxConverter>

   <!--CheckBoxBase-->
   <Style TargetType="{x:Type CheckBox}">
      <Setter Property="FocusVisualStyle">
         <Setter.Value>
            <Style>
               <Setter Property="Control.Template">
                  <Setter.Value>
                     <ControlTemplate>
                        <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                     </ControlTemplate>
                  </Setter.Value>
               </Setter>
            </Style>
         </Setter.Value>
      </Setter>
      <Setter Property="Background" Value="White"/>
      <Setter Property="BorderBrush" Value="#FF707070"/>
      <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
      <Setter Property="BorderThickness" Value="1"/>
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type CheckBox}">
               <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True" >
                  <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="Auto"/>
                     <ColumnDefinition Width="*"/>
                  </Grid.ColumnDefinitions>
                  <Border x:Name="checkBoxBorder" Height="{Binding Path=ActualHeight, ElementName=templateRoot}" Width="{Binding Path=ActualHeight, ElementName=templateRoot}" BorderBrush="{TemplateBinding BorderBrush}"
                     BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                     <Grid x:Name="markGrid">
                        <Path x:Name="optionMark" Data="F1M9.97498,1.22334L4.6983,9.09834 4.52164,9.09834 0,5.19331 1.27664,3.52165 4.255,6.08833 8.33331,1.52588E-05 9.97498,1.22334z" Fill="#FF212121" Margin="1" Opacity="0" Stretch="None"
                           RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Center" VerticalAlignment="Center">
                           <Path.RenderTransform>
                              <TransformGroup>
                                 <ScaleTransform>
                                    <ScaleTransform.ScaleX>
                                       <MultiBinding Converter="{StaticResource converter}">
                                          <Binding ElementName="templateRoot" Path="ActualHeight"/>
                                          <Binding ElementName="optionMark" Path="ActualHeight"/>
                                       </MultiBinding>
                                    </ScaleTransform.ScaleX>
                                    <ScaleTransform.ScaleY>
                                       <MultiBinding Converter="{StaticResource converter}">
                                          <Binding ElementName="templateRoot" Path="ActualHeight"/>

                                          <Binding ElementName="optionMark" Path="ActualHeight"/>
                                       </MultiBinding>
                                    </ScaleTransform.ScaleY>
                                 </ScaleTransform>
                              </TransformGroup>
                           </Path.RenderTransform>
                        </Path>
                        <Rectangle x:Name="indeterminateMark" Fill="#FF212121" Margin="2" Opacity="0"/>
                     </Grid>
                  </Border>
                  <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
               </Grid>
               <ControlTemplate.Triggers>
                  <Trigger Property="HasContent" Value="True">
                     <Setter Property="FocusVisualStyle">
                        <Setter.Value>
                           <Style>
                              <Setter Property="Control.Template">
                                 <Setter.Value>
                                    <ControlTemplate>
                                       <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                                    </ControlTemplate>
                                 </Setter.Value>
                              </Setter>
                           </Style>
                        </Setter.Value>
                     </Setter>
                     <Setter Property="Padding" Value="4,-1,0,0"/>
                  </Trigger>
                  <Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFF3F9FF"/>
                     <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FF5593FF"/>
                     <Setter Property="Fill" TargetName="optionMark" Value="#FF212121"/>
                     <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF212121"/>
                  </Trigger>
                  <Trigger Property="IsEnabled" Value="False">
                     <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFE6E6E6"/>
                     <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FFBCBCBC"/>
                     <Setter Property="Fill" TargetName="optionMark" Value="#FF707070"/>
                     <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF707070"/>
                  </Trigger>
                  <Trigger Property="IsPressed" Value="True">
                     <Setter Property="Background" TargetName="checkBoxBorder" Value="#FFD9ECFF"/>
                     <Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FF3C77DD"/>
                     <Setter Property="Fill" TargetName="optionMark" Value="#FF212121"/>
                     <Setter Property="Fill" TargetName="indeterminateMark" Value="#FF212121"/>
                  </Trigger>
                  <Trigger Property="IsChecked" Value="True">
                     <Setter Property="Opacity" TargetName="optionMark" Value="1"/>
                     <Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/>
                  </Trigger>
                  <Trigger Property="IsChecked" Value="{x:Null}">
                     <Setter Property="Opacity" TargetName="optionMark" Value="0"/>
                     <Setter Property="Opacity" TargetName="indeterminateMark" Value="1"/>
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--Riferimento al Converter che permette di massimizzare l'area libera interna al GroupBox-->
   <ControlExtensions:GroupBoxConverter x:Key="GroupBoxConverter"></ControlExtensions:GroupBoxConverter>
   <ControlExtensions:BorderGapMaskConverter x:Key="BorderGapMaskConverter"></ControlExtensions:BorderGapMaskConverter>

   <!--GroupBoxBase-->
   <Style TargetType="{x:Type GroupBox}">
      <Setter Property="BorderBrush" Value="Black"/>
      <Setter Property="BorderThickness" Value="1"/>
      <Setter Property="ControlExtensions:GroupBoxExtensions.FirstColumn" Value="6" />
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type GroupBox}">
               <Grid SnapsToDevicePixels="True">
                  <Grid.ColumnDefinitions>
                     <ColumnDefinition x:Name="FirstColumn" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(ControlExtensions:GroupBoxExtensions.FirstColumn)}"/>
                     <ColumnDefinition Width="Auto"/>
                     <ColumnDefinition Width="*"/>
                     <ColumnDefinition Width="6"/>
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                     <RowDefinition Height="Auto"/>
                     <RowDefinition Height="Auto"/>
                     <RowDefinition Height="*"/>
                     <RowDefinition Height="6"/>
                  </Grid.RowDefinitions>
                  <Border Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(ControlExtensions:GroupBoxExtensions.CornerRadius)}" Grid.Row="1" Grid.RowSpan="3" >
                     <Border.OpacityMask>
                        <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" UpdateSourceTrigger="Default">
                           <Binding ElementName="Header" Path="ActualWidth"/>
                           <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                           <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                           <Binding ElementName="FirstColumn" Path="Width"/>
                        </MultiBinding>
                     </Border.OpacityMask>
                  </Border>
                  <Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2">
                     <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                  </Border>
                  <ContentPresenter Grid.ColumnSpan="2" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                     <ContentPresenter.Margin>
                        <MultiBinding Converter="{StaticResource GroupBoxConverter}">
                           <Binding ElementName="Border" Path="BorderThickness"/>
                           <Binding ElementName="Border" Path="CornerRadius"/>
                           <Binding ElementName="FirstColumn" Path="Width"/>
                        </MultiBinding>
                     </ContentPresenter.Margin>
                  </ContentPresenter>
               </Grid>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--TextBlock-->

   <!--<Style TargetType="{x:Type TextBlock}">
      <Setter Property="TextWrapping" Value="NoWrap"/>
      <Setter Property="TextTrimming" Value="None"/>
   </Style>-->

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--TextBox-->

   <!--<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
      <GradientStop Color="#ABADB3" Offset="0.05"/>
      <GradientStop Color="#E2E3EA" Offset="0.07"/>
      <GradientStop Color="#E3E9EF" Offset="1"/>
   </LinearGradientBrush>
   <Style BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
      <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
      <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
      <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
      <Setter Property="BorderThickness" Value="1"/>
      <Setter Property="Padding" Value="1"/>
      <Setter Property="AllowDrop" Value="true"/>
      <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
      <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
      <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type TextBox}">
               <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                  <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
               </Border>
               <ControlTemplate.Triggers>
                  <Trigger Property="IsEnabled" Value="False">
                     <Setter Property="Opacity" TargetName="border" Value="0.56"/>
                  </Trigger>
                  <Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
                  </Trigger>
                  <Trigger Property="IsKeyboardFocused" Value="True">
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>-->

   <ControlTemplate x:Key="FixedTextBoxTemplate" TargetType="{x:Type TextBox}">
      <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
         <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
      </Border>
      <ControlTemplate.Triggers>
         <Trigger Property="IsEnabled" Value="False">
            <!--<Setter Property="Opacity" TargetName="border" Value="0.56"/>-->
         </Trigger>
         <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
         </Trigger>
         <Trigger Property="IsKeyboardFocused" Value="True">
            <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
         </Trigger>
      </ControlTemplate.Triggers>
   </ControlTemplate>

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--Template che permette di andare a capo-->
   <DataTemplate x:Key="ToggleButton_DataTemplate_Wrap">
      <TextBlock TextWrapping="Wrap" Text="{Binding}" />
   </DataTemplate>

   <!--ToggleButtonBase-->
   <Style TargetType="{x:Type ToggleButton}">
      <Setter Property="FocusVisualStyle">
         <Setter.Value>
            <Style>
               <Setter Property="Control.Template">
                  <Setter.Value>
                     <ControlTemplate>
                        <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
                     </ControlTemplate>
                  </Setter.Value>
               </Setter>
            </Style>
         </Setter.Value>
      </Setter>
      <Setter Property="Background" Value="#FFDDDDDD"/>
      <Setter Property="BorderBrush" Value="#FF707070"/>
      <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
      <Setter Property="BorderThickness" Value="1"/>
      <Setter Property="HorizontalContentAlignment" Value="Center"/>
      <Setter Property="VerticalContentAlignment" Value="Center"/>
      <Setter Property="Padding" Value="1"/>
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type ButtonBase}">
               <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(ControlExtensions:ToggleButtonExtensions.CornerRadius)}"
                  Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                  <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
               </Border>
               <ControlTemplate.Triggers>
                  <Trigger Property="Button.IsDefaulted" Value="True">
                     <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                  </Trigger>
                  <!--Commentato per per evitare che cambi colore quando ci si passa sopra con il mouse-->
                  <!--<Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFBEE6FD"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
                  </Trigger>-->
                  <!--<Trigger Property="IsPressed" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFC4E5F6"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
                  </Trigger>-->
                  <!--Commentato per poter gestire il colore di evidenziazione direttamente nello Style del ToggleButton--> 
                  <!--<Trigger Property="ToggleButton.IsChecked" Value="True">
                     <Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
                  </Trigger>-->
                  <!--<Trigger Property="IsEnabled" Value="False">
                     <Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
                     <Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
                     <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF838383"/>
                  </Trigger>-->
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!-- ______________________________________________________________________________________________________________________ -->

   <!--TreeViewBase-->
   <!--Style e colori della freccia di espansione, necessari per modificare il ContainerItemStyle perchè contiene riferimenti ad essi-->
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Fill" Color="#FF595959"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Checked.Stroke" Color="#FF262626"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Stroke" Color="#FF1BBBFA"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Fill" Color="Transparent"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Stroke" Color="#FF262626"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.MouseOver.Checked.Fill" Color="#FF595959"/>
   <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Fill" Color="Transparent"/>
   <SolidColorBrush x:Key="TreeViewItem.TreeArrow.Static.Stroke" Color="#FF989898"/>

   <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
      <Setter Property="Focusable" Value="False"/>
      <Setter Property="Width" Value="16"/>
      <Setter Property="Height" Value="16"/>
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type ToggleButton}">
               <Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
                  <Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="{StaticResource TreeViewItem.TreeArrow.Static.Fill}" Stroke="{StaticResource TreeViewItem.TreeArrow.Static.Stroke}">
                     <Path.RenderTransform>
                        <RotateTransform Angle="135" CenterY="3" CenterX="3"/>
                     </Path.RenderTransform>
                  </Path>
               </Border>
               <ControlTemplate.Triggers>
                  <Trigger Property="IsChecked" Value="True">
                     <Setter Property="RenderTransform" TargetName="ExpandPath">
                        <Setter.Value>
                           <RotateTransform Angle="180" CenterY="3" CenterX="3"/>
                        </Setter.Value>
                     </Setter>
                     <Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Fill}"/>
                     <Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.Static.Checked.Stroke}"/>
                  </Trigger>
                  <Trigger Property="IsMouseOver" Value="True">
                     <Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Stroke}"/>
                     <Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Fill}"/>
                  </Trigger>
                  <MultiTrigger>
                     <MultiTrigger.Conditions>
                        <Condition Property="IsMouseOver" Value="True"/>
                        <Condition Property="IsChecked" Value="True"/>
                     </MultiTrigger.Conditions>
                     <Setter Property="Stroke" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Stroke}"/>
                     <Setter Property="Fill" TargetName="ExpandPath" Value="{StaticResource TreeViewItem.TreeArrow.MouseOver.Checked.Fill}"/>
                  </MultiTrigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!-- ______________________________________________________________________________________________________________________ -->

</ResourceDictionary>
