﻿<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Microsoft.UI.Xaml.Controls"
    xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:contract7NotPresent="http://uno.ui/nocontract7"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d contract7NotPresent">

    <Style x:Key="DefaultTwoPaneViewStyle" TargetType="local:TwoPaneView">
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="MinWideModeWidth" Value="641"/>
        <Setter Property="MinTallModeHeight" Value="641"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:TwoPaneView">
                    <Grid x:Name="RootGrid" Background="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ModeStates">
                                <VisualState x:Name="ViewMode_LeftRight"/>

                                <VisualState x:Name="ViewMode_RightLeft">
                                    <VisualState.Setters>
                                        <contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="2"/>
                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>

                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="2"/>
                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="ViewMode_TopBottom">
                                    <VisualState.Setters>
                                        <contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="0"/>
                                        <contract7NotPresent:Setter Target="PART_Pane1.(Grid.Row)" Value="0"/>

                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Row)" Value="2"/>

                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="0"/>
                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Row)" Value="0"/>

                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Row)" Value="2"/>
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="ViewMode_BottomTop">
                                    <VisualState.Setters>
                                        <contract7NotPresent:Setter Target="PART_Pane1.(Grid.Column)" Value="0"/>
                                        <contract7NotPresent:Setter Target="PART_Pane1.(Grid.Row)" Value="2"/>

                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>
                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Row)" Value="0"/>

                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Column)" Value="0"/>
                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.(Grid.Row)" Value="2"/>

                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Row)" Value="0"/>
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="ViewMode_OneOnly">
                                    <VisualState.Setters>
                                        <contract7NotPresent:Setter Target="PART_Pane2.Visibility" Value="Collapsed"/>

                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.Visibility" Value="Collapsed"/>
                                    </VisualState.Setters>
                                </VisualState>

                                <VisualState x:Name="ViewMode_TwoOnly">
                                    <VisualState.Setters>
                                        <contract7NotPresent:Setter Target="PART_Pane1.Visibility" Value="Collapsed"/>
                                        <contract7NotPresent:Setter Target="PART_Pane2.(Grid.Column)" Value="0"/>

                                        <contract7Present:Setter Target="PART_Pane1ScrollViewer.Visibility" Value="Collapsed"/>
                                        <contract7Present:Setter Target="PART_Pane2ScrollViewer.(Grid.Column)" Value="0"/>
                                    </VisualState.Setters>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="PART_ColumnLeft" Width="Auto"/>
                            <ColumnDefinition x:Name="PART_ColumnMiddle" Width="0"/>
                            <ColumnDefinition x:Name="PART_ColumnRight" Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="PART_RowTop" Height="*"/>
                            <RowDefinition x:Name="PART_RowMiddle" Height="0"/>
                            <RowDefinition x:Name="PART_RowBottom" Height="0"/>
                        </Grid.RowDefinitions>

                        <contract7Present:ScrollViewer
                                x:Name="PART_Pane1ScrollViewer"
                                Grid.Column="0"
                                VerticalScrollBarVisibility="Auto">
                            <Border Child="{TemplateBinding Pane1}" />
                        </contract7Present:ScrollViewer>

                        <contract7Present:ScrollViewer
                                x:Name="PART_Pane2ScrollViewer"
                                Grid.Column="2"
                                VerticalScrollBarVisibility="Auto">
                            <Border Child="{TemplateBinding Pane2}" />
                        </contract7Present:ScrollViewer>

                        <contract7NotPresent:Border
                            x:Name="PART_Pane1"
                            Grid.Column="0"
                            Child="{TemplateBinding Pane1}"/>

                        <contract7NotPresent:Border
                            x:Name="PART_Pane2"
                            Grid.Column="2"
                            Child="{TemplateBinding Pane2}"/>

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

    <Style TargetType="local:TwoPaneView" BasedOn="{StaticResource DefaultTwoPaneViewStyle}" />

</ResourceDictionary>
