<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:MahApps.Metro.Controls">

    <Style TargetType="{x:Type local:SplitView}">
        <Setter Property="CompactPaneLength" Value="48" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="OpenPaneLength" Value="320" />
        <Setter Property="PaneBackground" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" />
        <Setter Property="PaneForeground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:SplitView}">
                    <Grid x:Name="root"
                          Background="{TemplateBinding Background}"
                          Tag="{TemplateBinding TemplateSettings}">
                        <Grid.Resources>
                            <FrameworkElement x:Key="ProxyElement" DataContext="{TemplateBinding TemplateSettings}" />

                            <Storyboard x:Key="ClosedToOpenOverlayLeftStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="ClosedToOpenOverlayRightStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="ClosedCompactLeftToOpenCompactOverlayLeftStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLengthMinusCompactLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="ClosedCompactRightToOpenCompactOverlayRightStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="*" />
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition2"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame x:Name="PART_ClosedCompactRightToOpenCompactOverlayRightPaneClipRectangleTransformXAnimation"
                                                            KeyTime="0:0:0"
                                                            Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLengthMinusCompactLength}" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.35"
                                                          Value="0" />
                                </DoubleAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenOverlayLeftToClosedStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneTransform" Storyboard.TargetProperty="X">
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLength}" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLength}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenOverlayRightToClosedStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneTransform" Storyboard.TargetProperty="X">
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLength}" />
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLength}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenCompactOverlayLeftToClosedCompactLeftStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLengthMinusCompactLength}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenCompactOverlayRightToClosedCompactRightStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="*" />
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition2"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="X">
                                    <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0" />
                                    <SplineDoubleKeyFrame KeySpline="0.1,0.9 0.2,1.0"
                                                          KeyTime="0:0:0.12"
                                                          Value="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLengthMinusCompactLength}" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="ClosedCompactLeftStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation Storyboard.TargetName="PaneClipRectangleTransform"
                                                 Storyboard.TargetProperty="X"
                                                 To="{Binding ElementName=ProxyElement, Path=DataContext.NegativeOpenPaneLengthMinusCompactLength}"
                                                 Duration="0:0:0" />
                            </Storyboard>

                            <Storyboard x:Key="ClosedCompactRightStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="*" />
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition2"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <DoubleAnimation Storyboard.TargetName="PaneClipRectangleTransform"
                                                 Storyboard.TargetProperty="X"
                                                 To="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLengthMinusCompactLength}"
                                                 Duration="0:0:0" />
                            </Storyboard>

                            <Storyboard x:Key="OpenOverlayLeftStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenOverlayRightStoryboard">
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenInlineLeftStoryboard">
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenInlineRightStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="*" />
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition2"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenCompactOverlayLeftStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.Column)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard x:Key="OpenCompactOverlayRightStoryboard">
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition1"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="*" />
                                <local:GridLengthAnimation BeginTime="0:0:0"
                                                           Storyboard.TargetName="ColumnDefinition2"
                                                           Storyboard.TargetProperty="(ColumnDefinition.Width)"
                                                           To="{Binding ElementName=ProxyElement, Path=DataContext.CompactPaneGridLength}" />
                                <Int32AnimationUsingKeyFrames Storyboard.TargetName="ContentRoot" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                    <DiscreteInt32KeyFrame KeyTime="0:0:0" Value="1" />
                                </Int32AnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PaneRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Right}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="HorizontalAlignment">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static HorizontalAlignment.Left}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HCPaneBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LightDismissLayer" Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>

                        </Grid.Resources>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneGridLength, FallbackValue=0}" />
                            <ColumnDefinition x:Name="ColumnDefinition2" Width="*" />
                        </Grid.ColumnDefinitions>

                        <FrameworkElement x:Name="ProxyElement"
                                          Width="0"
                                          Height="0"
                                          DataContext="{Binding TemplateSettings, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                          Focusable="False"
                                          Visibility="Collapsed" />

                        <!--  Content Area  -->
                        <Grid x:Name="ContentRoot"
                              Grid.Column="0"
                              Grid.ColumnSpan="2">
                            <ContentControl HorizontalAlignment="Stretch"
                                            VerticalAlignment="Stretch"
                                            Content="{TemplateBinding Content}"
                                            Focusable="False"
                                            IsTabStop="False" />
                            <Rectangle x:Name="LightDismissLayer"
                                       Fill="Transparent"
                                       Visibility="Collapsed" />
                        </Grid>

                        <!--  Pane Content Area  -->
                        <Grid x:Name="PaneRoot"
                              Grid.Column="0"
                              Grid.ColumnSpan="2"
                              Width="{Binding ElementName=ProxyElement, Path=DataContext.OpenPaneLength}"
                              HorizontalAlignment="Left"
                              Background="{TemplateBinding PaneBackground}"
                              Visibility="Collapsed">
                            <Grid.RenderTransform>
                                <TranslateTransform x:Name="PaneTransform" />
                            </Grid.RenderTransform>
                            <Grid.Clip>
                                <RectangleGeometry x:Name="PaneClipRectangle">
                                    <RectangleGeometry.Transform>
                                        <TranslateTransform x:Name="PaneClipRectangleTransform" />
                                    </RectangleGeometry.Transform>
                                </RectangleGeometry>
                            </Grid.Clip>
                            <ContentControl HorizontalAlignment="Stretch"
                                            VerticalAlignment="Stretch"
                                            Content="{TemplateBinding Pane}"
                                            Focusable="False"
                                            Foreground="{TemplateBinding PaneForeground}"
                                            IsTabStop="False" />
                            <Rectangle x:Name="HCPaneBorder"
                                       Width="1"
                                       HorizontalAlignment="Right"
                                       Fill="Transparent"
                                       Visibility="Collapsed" />
                        </Grid>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="DisplayModeStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition Storyboard="{StaticResource ClosedToOpenOverlayLeftStoryboard}"
                                                      From="Closed"
                                                      To="OpenOverlayLeft" />
                                    <VisualTransition Storyboard="{StaticResource ClosedToOpenOverlayRightStoryboard}"
                                                      From="Closed"
                                                      To="OpenOverlayRight" />
                                    <VisualTransition Storyboard="{StaticResource ClosedCompactLeftToOpenCompactOverlayLeftStoryboard}"
                                                      From="ClosedCompactLeft"
                                                      To="OpenCompactOverlayLeft" />
                                    <VisualTransition Storyboard="{StaticResource ClosedCompactRightToOpenCompactOverlayRightStoryboard}"
                                                      From="ClosedCompactRight"
                                                      To="OpenCompactOverlayRight" />
                                    <VisualTransition Storyboard="{StaticResource OpenOverlayLeftToClosedStoryboard}"
                                                      From="OpenOverlayLeft"
                                                      To="Closed" />
                                    <VisualTransition Storyboard="{StaticResource OpenOverlayRightToClosedStoryboard}"
                                                      From="OpenOverlayRight"
                                                      To="Closed" />
                                    <VisualTransition Storyboard="{StaticResource OpenCompactOverlayLeftToClosedCompactLeftStoryboard}"
                                                      From="OpenCompactOverlayLeft"
                                                      To="ClosedCompactLeft" />
                                    <VisualTransition Storyboard="{StaticResource OpenCompactOverlayRightToClosedCompactRightStoryboard}"
                                                      From="OpenCompactOverlayRight"
                                                      To="ClosedCompactRight" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="None" />
                                <VisualState x:Name="Closed" />
                                <VisualState x:Name="ClosedCompactLeft" Storyboard="{StaticResource ClosedCompactLeftStoryboard}" />
                                <VisualState x:Name="ClosedCompactRight" Storyboard="{StaticResource ClosedCompactRightStoryboard}" />
                                <VisualState x:Name="OpenOverlayLeft" Storyboard="{StaticResource OpenOverlayLeftStoryboard}" />
                                <VisualState x:Name="OpenOverlayRight" Storyboard="{StaticResource OpenOverlayRightStoryboard}" />
                                <VisualState x:Name="OpenInlineLeft" Storyboard="{StaticResource OpenInlineLeftStoryboard}" />
                                <VisualState x:Name="OpenInlineRight" Storyboard="{StaticResource OpenInlineRightStoryboard}" />
                                <VisualState x:Name="OpenCompactOverlayLeft" Storyboard="{StaticResource OpenCompactOverlayLeftStoryboard}" />
                                <VisualState x:Name="OpenCompactOverlayRight" Storyboard="{StaticResource OpenCompactOverlayRightStoryboard}" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
    </Style>
</ResourceDictionary>