<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!--header templates-->
    <DataTemplate x:Key="PageHeader">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="80"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Style="{StaticResource CustomNavigationBackButtonNormalStyle}" Command="{Binding GoBackCommand}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Image Grid.Column="1" Source="{StaticResource AppLogoImage}" Width="80" Height="80" VerticalAlignment="Center" HorizontalAlignment="Left" Stretch="Uniform" />
            <TextBlock Grid.Column="2" Margin="24,0,0,0" Text="{StaticResource AppTitle}" Style="{StaticResource AppTitleStyle}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" IsHitTestVisible="false"/>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="PageHeaderSnapped">
        <Grid Margin="24,0,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Button Margin="0,24,0,24" Style="{StaticResource CustomNavigationBackButtonNormalStyle}" Command="{Binding GoBackCommand}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" Source="{StaticResource AppLogoImage}" Width="80" Height="80" VerticalAlignment="Center" HorizontalAlignment="Left" Stretch="Uniform" />
                <TextBlock Grid.Column="1" Margin="24,0,0,0" Text="{StaticResource AppTitle}" Style="{StaticResource AppTitleStyle}" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="NoWrap" IsHitTestVisible="false"/>
            </Grid>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="PageHeaderSimple">
        <Grid Width="120" HorizontalAlignment="Left">
            <Button Style="{StaticResource CustomNavigationBackButtonNormalStyle}" Command="{Binding GoBackCommand}" Width="60" Height="60" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="MainPageHeader">
        <Grid Margin="-40,-30,0,0">
            <ContentPresenter ContentTemplate="{StaticResource PageHeader}"/>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="MainPageHeaderSnapped">
        <Grid Margin="-40,-30,0,0">
            <ContentPresenter ContentTemplate="{StaticResource PageHeaderSnapped}"/>
        </Grid>
    </DataTemplate>
    <!--end of header templates-->

    <Style x:Key="HorizontalScrollViewerStyle" TargetType="ScrollViewer">
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled" />
        <Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" />
        <Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
    </Style>
    
    
    <!--Windows styles-->
    <Style x:Key="HubSectionStyle" TargetType="HubSection">
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Padding" Value="40,40,40,44"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HubSection">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                        <Border.Resources>
                            <ControlTemplate x:Key="HeaderButtonTemplate" TargetType="Button">
                                <Grid Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal"/>
                                            <VisualState x:Name="PointerOver"/>
                                            <VisualState x:Name="Pressed"/>
                                            <VisualState x:Name="Disabled"/>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FocusStates">
                                            <VisualState x:Name="Focused"/>
                                            <VisualState x:Name="Unfocused"/>
                                            <VisualState x:Name="PointerFocused"/>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="IsHeaderInteractiveStates">
                                            <VisualState x:Name="HeaderInteractive">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="IsHeaderInteractiveMarker">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="HeaderNonInteractive"/>
                                        </VisualStateGroup>
                                        <VisualStateGroup x:Name="FlowDirectionStates">
                                            <VisualState x:Name="LeftToRight"/>
                                            <VisualState x:Name="RightToLeft">
    											<Storyboard>
    												<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Text" Storyboard.TargetName="IsHeaderInteractiveMarker">
    													<DiscreteObjectKeyFrame KeyTime="0" Value="  &#xE26C;"/>
    												</ObjectAnimationUsingKeyFrames>
    											</Storyboard>
    										</VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <StackPanel Orientation="Horizontal">
                                        <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" OpticalMarginAlignment="TrimSideBearings" TextLineBounds="Tight" VerticalAlignment="Center" Margin="0,0,0,0"/>
                                        <TextBlock x:Name="IsHeaderInteractiveMarker" AutomationProperties.AccessibilityView="Raw" FontFamily="{ThemeResource SymbolThemeFontFamily}" OpticalMarginAlignment="TrimSideBearings" TextLineBounds="Tight" Text=" &#xE26B;" Visibility="Collapsed" VerticalAlignment="Center" Foreground="{StaticResource PageTitleForeground}" Margin="0,0,0,0"/>
                                    </StackPanel>
                                    <Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Margin="-5" Opacity="0" StrokeDashOffset="1.5" StrokeEndLineCap="Square" Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}" StrokeDashArray="1,1"/>
                                    <Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Margin="-5" Opacity="0" StrokeDashOffset="0.5" StrokeEndLineCap="Square" Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}" StrokeDashArray="1,1"/>
                                </Grid>
                            </ControlTemplate>
                        </Border.Resources>
                        <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Rectangle x:Name="HubHeaderPlaceholder" Grid.Row="0"/>
                            <Button x:Name="HeaderButton" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" FontWeight="{ThemeResource HubSectionHeaderThemeFontWeight}" FontSize="{ThemeResource HubSectionHeaderThemeFontSize}" Margin="{ThemeResource HubSectionHeaderThemeMargin}" Grid.Row="1" Template="{StaticResource HeaderButtonTemplate}"/>
                            <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Row="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
