<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
    xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
    xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
    mc:Ignorable="d">

    <Style x:Key="HeaderToggleButtonStyle" TargetType="ToggleButton">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundTransparentBrush}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ToggleButtonBorderThemeThickness}" />
        <Setter Property="Padding" Value="8,4,8,4" />
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="UseSystemFocusVisuals" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal">
                                    <Storyboard>
                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="0.0"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource ToggleButtonBackgroundPointerOver}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="0.0"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource ToggleButtonBackgroundPressed}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="0.0"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                        <PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="0.0"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightAccentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="{Binding ElementName=ArrowRotation, Path=Value}"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CheckedPointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightAccentBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="{Binding ElementName=ArrowRotation, Path=Value}"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CheckedPressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightBaseMediumLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="{Binding ElementName=ArrowRotation, Path=Value}"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                        <PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="CheckedDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="Arrow">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlDisabledBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlDisabledBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation BeginTime="0:0:0" Duration="0:0:0.1" To="{Binding ElementName=ArrowRotation, Path=Value}"
                                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
                                                         Storyboard.TargetName="Arrow" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="IndeterminatePointerOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="Arrow">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightBaseHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightBaseHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <PointerUpThemeAnimation Storyboard.TargetName="RootGrid" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="IndeterminatePressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlBackgroundBaseMediumLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="Arrow">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightBaseHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlHighlightBaseHighBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <PointerDownThemeAnimation Storyboard.TargetName="RootGrid" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="IndeterminateDisabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                                                                       Storyboard.TargetName="RootGrid">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="Arrow">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlDisabledBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground"
                                                                       Storyboard.TargetName="ContentPresenter">
                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                    Value="{ThemeResource SystemControlDisabledBaseLowBrush}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>

                            <VisualStateGroup x:Name="ExpandDirectionStates">
                                <VisualState x:Name="RightDirection" />

                                <VisualState x:Name="DownDirection" />

                                <VisualState x:Name="LeftDirection">
                                    <VisualState.Setters>
                                        <Setter Target="ArrowRotation.Value" Value="-90" />
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="UpDirection">
                                    <VisualState.Setters>
                                        <Setter Target="ArrowRotation.Value" Value="-90" />
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Slider x:Name="ArrowRotation" Visibility="Collapsed" Value="90" Minimum="-180" Maximum="180" />

                        <SymbolIcon x:Name="Arrow" Width="40"
                                    RenderTransformOrigin="0.5,0.5"
                                    Symbol="Forward">
                            <SymbolIcon.RenderTransform>
                                <RotateTransform />
                            </SymbolIcon.RenderTransform>
                        </SymbolIcon>

                        <ContentPresenter Grid.Column="1"
                                          x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw"
                                          BorderBrush="{TemplateBinding BorderBrush}"
                                          BorderThickness="{TemplateBinding BorderThickness}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          ContentTransitions="{TemplateBinding ContentTransitions}"
                                          Content="{TemplateBinding Content}"
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Padding="{TemplateBinding Padding}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          HorizontalAlignment="Left"
                                          RenderTransformOrigin="0.5,0.5" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="controls:Expander">
        <Setter Property="Header" Value="Header" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="animations:Implicit.Animations">
            <Setter.Value>
                <animations:AnimationCollection>
                    <animations:OffsetAnimation Duration="0:0:0.3"></animations:OffsetAnimation>
                </animations:AnimationCollection>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Expander">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="DisplayModeAndDirectionStates">
                                <VisualState x:Name="VisibleLeft">
                                    <VisualState.Setters>
                                        <Setter Target="PART_MainContent.Visibility" Value="Visible" />

                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="1" />
                                        <Setter Target="PART_MainContent.(extensions:VisualEx.NormalizedCenterPoint)" Value="1,0,0" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="-90" />

                                        <Setter Target="ColumnOne.Width" Value="*" />
                                        <Setter Target="ColumnTwo.Width" Value="Auto" />

                                        <Setter Target="PART_MainContentShowScaleAnimation.From" Value="0,1,0" />

                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="VisibleDown">
                                    <VisualState.Setters>
                                        <Setter Target="PART_MainContent.Visibility" Value="Visible" />
                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="VisibleRight">
                                    <VisualState.Setters>
                                        <Setter Target="PART_MainContent.Visibility" Value="Visible" />

                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="-90" />

                                        <Setter Target="PART_MainContentShowScaleAnimation.From" Value="0,1,0" />

                                    </VisualState.Setters>

                                </VisualState>
                                <VisualState x:Name="VisibleUp">
                                    <VisualState.Setters>
                                        <Setter Target="PART_MainContent.Visibility" Value="Visible" />

                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="RowOne.Height" Value="*" />
                                        <Setter Target="RowTwo.Height" Value="Auto" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="0" />
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="CollapsedLeft">
                                    <VisualState.Setters>
                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="1" />
                                        <Setter Target="PART_MainContent.(extensions:VisualEx.NormalizedCenterPoint)" Value="1,0,0" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="-90" />

                                        <Setter Target="ColumnOne.Width" Value="*" />
                                        <Setter Target="ColumnTwo.Width" Value="Auto" />

                                        <Setter Target="PART_MainContentHideScaleAnimation.To" Value="0,1,0" />

                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="CollapsedDown">
                                    <VisualState.Setters>
                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="CollapsedRight">
                                    <VisualState.Setters>
                                        <Setter Target="PART_MainContent.Visibility" Value="Collapsed"></Setter>

                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="2" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="1" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="1" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="-90" />

                                        <Setter Target="PART_MainContentHideScaleAnimation.To" Value="0,1,0" />

                                    </VisualState.Setters>
                                </VisualState>
                                <VisualState x:Name="CollapsedUp">
                                    <VisualState.Setters>
                                        <Setter Target="PART_LayoutTransformer.(Grid.Row)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_LayoutTransformer.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="PART_MainContent.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_MainContent.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_MainContent.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="PART_ContentOverlay.(Grid.Row)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.RowSpan)" Value="1" />
                                        <Setter Target="PART_ContentOverlay.(Grid.Column)" Value="0" />
                                        <Setter Target="PART_ContentOverlay.(Grid.ColumnSpan)" Value="2" />

                                        <Setter Target="RowOne.Height" Value="*" />
                                        <Setter Target="RowTwo.Height" Value="Auto" />

                                        <Setter Target="RotateLayoutTransform.Angle" Value="0" />
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid x:Name="PART_RootGrid">
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="RowOne" Height="Auto" />
                                <RowDefinition x:Name="RowTwo" Height="*" />
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnOne" Width="Auto" />
                                <ColumnDefinition x:Name="ColumnTwo" Width="*" />
                            </Grid.ColumnDefinitions>

                            <ContentControl Grid.Row="1" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="2"
                                            x:Name="PART_ContentOverlay"
                                            Content="{TemplateBinding ContentOverlay}"
                                            HorizontalAlignment="Stretch"
                                            HorizontalContentAlignment="Stretch"
                                            VerticalAlignment="Stretch"
                                            VerticalContentAlignment="Stretch">
                                <ContentControl.RenderTransform>
                                    <ScaleTransform />
                                </ContentControl.RenderTransform>
                            </ContentControl>

                            <Grid Grid.Row="1" 
                                      Grid.RowSpan="1" 
                                      Grid.Column="0" 
                                      Grid.ColumnSpan="2"
                                      x:Name="PART_MainContent"
                                      Visibility="Collapsed"
                                      extensions:VisualEx.NormalizedCenterPoint="0"
                                      Background="{TemplateBinding Background}">

                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                      HorizontalContentAlignment="Stretch"
                                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                      VerticalContentAlignment="Stretch" >
                                    <animations:Implicit.ShowAnimations>
                                        <animations:OpacityAnimation Duration="0:0:0.3" From="0" To="1" Delay="0:0:0.25" SetInitialValueBeforeDelay="True"></animations:OpacityAnimation>
                                        <animations:TranslationAnimation Duration="0:0:0.3" From="0, 20, 0" To="0" Delay="0:0:0.25"></animations:TranslationAnimation>
                                    </animations:Implicit.ShowAnimations>

                                    <animations:Implicit.HideAnimations>
                                        <animations:OpacityAnimation Duration="0:0:0.2" To="0"></animations:OpacityAnimation>
                                    </animations:Implicit.HideAnimations>
                                </ContentPresenter>
                                <animations:Implicit.ShowAnimations>
                                    <animations:ScaleAnimation x:Name="PART_MainContentShowScaleAnimation" Duration="0:0:0.3" From="1, 0, 0" To="1" ></animations:ScaleAnimation>
                                </animations:Implicit.ShowAnimations>

                                <animations:Implicit.HideAnimations>
                                    <animations:ScaleAnimation x:Name="PART_MainContentHideScaleAnimation" Duration="0:0:0.2" To="1, 0, 0" ></animations:ScaleAnimation>
                                </animations:Implicit.HideAnimations>
                            </Grid>

                            <controls:LayoutTransformControl Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="2"
                                                             x:Name="PART_LayoutTransformer"
                                                                 Background="{TemplateBinding Background}"
                                                             RenderTransformOrigin="0.5,0.5">
                                <controls:LayoutTransformControl.Transform>
                                    <RotateTransform x:Name="RotateLayoutTransform" Angle="0" />
                                </controls:LayoutTransformControl.Transform>

                                <ToggleButton x:Name="PART_ExpanderToggleButton" 
                                              Height="40"
                                              TabIndex="0"
                                              AutomationProperties.Name="Expand"
                                              Style="{StaticResource HeaderToggleButtonStyle}" 
                                              VerticalAlignment="Bottom" HorizontalAlignment="Stretch" 
                                              Foreground="{TemplateBinding Foreground}"
                                              ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}"
                                              IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
                                <animations:Implicit.Animations>
                                    <animations:OffsetAnimation Duration="0:0:0.3"></animations:OffsetAnimation>
                                </animations:Implicit.Animations>
                            </controls:LayoutTransformControl>

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