<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <!--  Add Resources Here  -->

    <ControlTheme x:Key="{x:Type SplitView}" TargetType="SplitView">
        <Setter Property="OpenPaneLength" Value="{DynamicResource SplitViewOpenPaneThemeLength}" />
        <Setter Property="CompactPaneLength" Value="{DynamicResource SplitViewCompactPaneThemeLength}" />
        <Setter Property="PaneBackground" Value="{DynamicResource SplitViewPaneBackground}" />

        <Style Selector="^:left">
            <Setter Property="Template">
                <ControlTemplate TargetType="SplitView">
                    <Grid Name="Container" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <!--  why is this throwing a binding error?  -->
                            <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Panel
                            Name="PART_PaneRoot"
                            HorizontalAlignment="Left"
                            Background="{TemplateBinding PaneBackground}"
                            ClipToBounds="True"
                            ZIndex="100">
                            <ContentPresenter
                                x:Name="PART_PanePresenter"
                                Content="{TemplateBinding Pane}"
                                ContentTemplate="{TemplateBinding PaneTemplate}" />
                            <Rectangle
                                Name="HCPaneBorder"
                                Width="1"
                                HorizontalAlignment="Right"
                                Fill="{DynamicResource SplitViewSeparatorBackground}" />
                        </Panel>

                        <Panel Name="ContentRoot">
                            <ContentPresenter
                                x:Name="PART_ContentPresenter"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                            <Rectangle
                                Name="LightDismissLayer"
                                Fill="Transparent"
                                IsVisible="False" />
                        </Panel>

                    </Grid>
                </ControlTemplate>
            </Setter>

            <Style Selector="^:overlay">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="0" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Grid.ColumnSpan" Value="2" />
                </Style>
            </Style>

            <Style Selector="^:compactinline">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>

            <Style Selector="^:compactoverlay">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <!--  ColumnSpan should be 2  -->
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>

            <Style Selector="^:inline">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>
        </Style>

        <Style Selector="^:right">
            <Setter Property="Template">
                <ControlTemplate>
                    <Grid Name="Container" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneColumnGridLength}" />
                        </Grid.ColumnDefinitions>

                        <Panel
                            Name="PART_PaneRoot"
                            HorizontalAlignment="Right"
                            Background="{TemplateBinding PaneBackground}"
                            ClipToBounds="True"
                            ZIndex="100">
                            <ContentPresenter
                                x:Name="PART_PanePresenter"
                                Content="{TemplateBinding Pane}"
                                ContentTemplate="{TemplateBinding PaneTemplate}" />
                            <Rectangle
                                Name="HCPaneBorder"
                                Width="1"
                                HorizontalAlignment="Left"
                                Fill="{DynamicResource SplitViewSeparatorBackground}" />
                        </Panel>

                        <Panel Name="ContentRoot">
                            <ContentPresenter
                                x:Name="PART_ContentPresenter"
                                Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                            <Rectangle Name="LightDismissLayer" />
                        </Panel>

                    </Grid>
                </ControlTemplate>
            </Setter>

            <Style Selector="^:overlay">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                    <Setter Property="Grid.ColumnSpan" Value="2" />
                    <Setter Property="Grid.Column" Value="1" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Grid.ColumnSpan" Value="2" />
                </Style>
            </Style>

            <Style Selector="^:compactinline">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>

            <Style Selector="^:compactoverlay">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Grid.ColumnSpan" Value="2" />
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>

            <Style Selector="^:inline">
                <Style Selector="^ /template/ Panel#PART_PaneRoot">
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                    <Setter Property="Grid.Column" Value="1" />
                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
                </Style>
                <Style Selector="^ /template/ Panel#ContentRoot">
                    <Setter Property="Grid.Column" Value="0" />
                    <Setter Property="Grid.ColumnSpan" Value="1" />
                </Style>
            </Style>
        </Style>

        <Style Selector="^:open">
            <Style Selector="^ /template/ Panel#PART_PaneRoot">
                <Setter Property="Transitions">
                    <Transitions>
                        <DoubleTransition
                            Easing="{StaticResource SplitViewPaneAnimationEasing}"
                            Property="Width"
                            Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" />
                    </Transitions>
                </Setter>
                <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=OpenPaneLength}" />
            </Style>
            <Style Selector="^ /template/ Rectangle#LightDismissLayer">
                <Setter Property="Transitions">
                    <Transitions>
                        <DoubleTransition
                            Easing="{StaticResource SplitViewPaneAnimationEasing}"
                            Property="Opacity"
                            Duration="{StaticResource SplitViewPaneAnimationOpenDuration}" />
                    </Transitions>
                </Setter>
                <Setter Property="Opacity" Value="1.0" />
            </Style>
        </Style>

        <Style Selector="^:closed">
            <Style Selector="^ /template/ Panel#PART_PaneRoot">
                <Setter Property="Transitions">
                    <Transitions>
                        <DoubleTransition
                            Easing="{StaticResource SplitViewPaneAnimationEasing}"
                            Property="Width"
                            Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" />
                    </Transitions>
                </Setter>
                <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ClosedPaneWidth}" />
            </Style>
            <Style Selector="^ /template/ Rectangle#LightDismissLayer">
                <Setter Property="Transitions">
                    <Transitions>
                        <DoubleTransition
                            Easing="{StaticResource SplitViewPaneAnimationEasing}"
                            Property="Opacity"
                            Duration="{StaticResource SplitViewPaneAnimationCloseDuration}" />
                    </Transitions>
                </Setter>
                <Setter Property="Opacity" Value="0.0" />
            </Style>
        </Style>

        <Style Selector="^:lightdismiss /template/ Rectangle#LightDismissLayer">
            <Setter Property="Fill" Value="#99000000" />
        </Style>
        <Style Selector="^:overlay:open /template/ Rectangle#LightDismissLayer">
            <Setter Property="IsVisible" Value="True" />
        </Style>
        <Style Selector="^:compactoverlay:open /template/ Rectangle#LightDismissLayer">
            <Setter Property="IsVisible" Value="True" />
        </Style>
    </ControlTheme>
</ResourceDictionary>
