<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:tm="using:SearchUI.TemplateManager"
                    x:Key="Shared.SerpGridViewStyles_8_1_RTM">

    <!-- Style override for the top level content template which has left alignment -->
    <Style x:Key="Resources.Shared.DefaultContentControlStyle"
           TargetType="ContentControl">
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="IsTabStop"
                Value="False" />
    </Style>
    
    <!-- Group of 5 DataTemplate mapps to [[ext:viewModes]] -->
    <DataTemplate x:Key="Local.SerpContentTemplate.Horizontal">
        <ContentControl Content="{Binding}"
                        Style="{StaticResource Resources.Shared.DefaultContentControlStyle}"
                        ContentTemplate="{Binding Extended:viewModes.Extended:Horizontal.System_ConnectedSearch_RenderingTemplate, Converter={CustomResource StringToResource}}" />
    </DataTemplate>
    <DataTemplate x:Key="Local.SerpContentTemplate.HorizontalLarge">
        <ContentControl Content="{Binding}"
                        Style="{StaticResource Resources.Shared.DefaultContentControlStyle}"
                        ContentTemplate="{Binding Extended:viewModes.Extended:HorizontalLarge.System_ConnectedSearch_RenderingTemplate, Converter={CustomResource StringToResource}}" />
    </DataTemplate>
    <DataTemplate x:Key="Local.SerpContentTemplate.Vertical">
        <ContentControl Content="{Binding}"
                        Style="{StaticResource Resources.Shared.DefaultContentControlStyle}"
                        ContentTemplate="{Binding Extended:viewModes.Extended:Vertical.System_ConnectedSearch_RenderingTemplate, Converter={CustomResource StringToResource}}" />
    </DataTemplate>
    <DataTemplate x:Key="Local.SerpContentTemplate.VerticalLarge">
        <ContentControl Content="{Binding}"
                        Style="{StaticResource Resources.Shared.DefaultContentControlStyle}"
                        ContentTemplate="{Binding Extended:viewModes.Extended:VerticalLarge.System_ConnectedSearch_RenderingTemplate, Converter={CustomResource StringToResource}}" />
    </DataTemplate>
    <DataTemplate x:Key="Local.SerpContentTemplate.VerticalNarrow">
        <ContentControl Content="{Binding}"
                        Style="{StaticResource Resources.Shared.DefaultContentControlStyle}"
                        ContentTemplate="{Binding Extended:viewModes.Extended:VerticalNarrow.System_ConnectedSearch_RenderingTemplate, Converter={CustomResource StringToResource}}" />
    </DataTemplate>

    <Style x:Key="Resources.Shared.TopLevelGridViewItemStyle"
           TargetType="GridViewItem"
           BasedOn="{CustomResource Resources.Shared.ResultGridViewItemStyle}">
        <Setter Property="Background"
                Value="{ThemeResource ImmersiveLightBackgroundBrush}" />
        <Setter Property="BorderThickness"
                Value="4" />
        <Setter Property="tm:SetterBinding.Setters">
            <Setter.Value>
                <SetterBaseCollection>
                    <Setter Property="AutomationProperties.AutomationId">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:automation.Extended:Id" />
                        </Setter.Value>
                    </Setter>
                    <Setter Property="AutomationProperties.Name">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:automation.Extended:Name" />
                        </Setter.Value>
                    </Setter>
                </SetterBaseCollection>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Local.TopLevelSuppressedGridViewItemStyle"
           TargetType="GridViewItem"
           BasedOn="{CustomResource Resources.Shared.SuppressedGridViewItemStyle}">
        <Setter Property="tm:SetterBinding.Setters">
            <Setter.Value>
                <SetterBaseCollection>
                    <Setter Property="AutomationProperties.AutomationId">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:automation.Extended:Id" />
                        </Setter.Value>
                    </Setter>
                    <Setter Property="AutomationProperties.Name">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:automation.Extended:Name" />
                        </Setter.Value>
                    </Setter>
                </SetterBaseCollection>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Group of 5 default top level GridViewItem style for different view modes -->
    <Style x:Key="Resources.Shared.SerpGridViewItem.Horizontal"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Resources.Shared.TopLevelGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.Horizontal}" />
        <Setter Property="Margin"
                Value="0, 0, 10, 0" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.HorizontalLarge"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Resources.Shared.TopLevelGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.HorizontalLarge}" />
        <Setter Property="Margin"
                Value="0, 0, 20, 0" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.Vertical"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Resources.Shared.TopLevelGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.Vertical}" />
        <Setter Property="Margin"
                Value="0, 0, 20, 20" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.VerticalLarge"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Resources.Shared.TopLevelGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.VerticalLarge}" />
        <Setter Property="Margin"
                Value="0, 0, 0, 20" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.VerticalNarrow"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Resources.Shared.TopLevelGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.VerticalNarrow}" />
        <Setter Property="Margin"
                Value="0" />
    </Style>

    <!-- Group of 5 top level GridViewItem style that suppressed interations -->
    <Style x:Key="Resources.Shared.SerpGridViewItem.Suppressed.Horizontal"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Local.TopLevelSuppressedGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.Horizontal}" />
        <Setter Property="Margin"
                Value="0, 0, 10, 0" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.Suppressed.HorizontalLarge"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Local.TopLevelSuppressedGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.HorizontalLarge}" />
        <Setter Property="Margin"
                Value="0, 0, 20, 0" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.Suppressed.Vertical"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Local.TopLevelSuppressedGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.Vertical}" />
        <Setter Property="Margin"
                Value="0, 0, 20, 20" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.Suppressed.VerticalLarge"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Local.TopLevelSuppressedGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.VerticalLarge}" />
        <Setter Property="Margin"
                Value="0, 0, 0, 20" />
    </Style>
    <Style x:Key="Resources.Shared.SerpGridViewItem.Suppressed.VerticalNarrow"
           TargetType="GridViewItem"
           BasedOn="{StaticResource Local.TopLevelSuppressedGridViewItemStyle}">
        <Setter Property="ContentTemplate"
                Value="{StaticResource Local.SerpContentTemplate.VerticalNarrow}" />
        <Setter Property="Margin"
                Value="0" />
    </Style>

    <!--Interior margin of each top level item -->
    <Style x:Key="Resources.Shared.TopLevelDataTemplateRootStyle"
           TargetType="Panel">
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="VerticalAlignment"
                Value="Stretch" />
        <Setter Property="Margin"
                Value="12" />
    </Style>

    <!--Interior margin of each top level suppressed item -->
    <Style x:Key="Resources.Shared.SuppressedTopLevelDataTemplateRootStyle"
           TargetType="Panel">
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="VerticalAlignment"
                Value="Stretch" />
        <Setter Property="Margin"
                Value="10" />
    </Style>

    <!--Interior margin of the fake top level item inside a nested grid view-->
    <Style x:Key="Resources.Shared.NestedTopLevelDataTemplateRootStyle"
           TargetType="Panel"
           BasedOn="{StaticResource Resources.Shared.TopLevelDataTemplateRootStyle}">
        <Setter Property="Margin"
                Value="12, 12, 12, 8" />
    </Style>

    <Style x:Key="Resources.Shared.AppContent.AutomationGridViewItemStyle"
           TargetType="GridViewItem"
           BasedOn="{CustomResource Resources.Shared.NestedGridViewItemStyle}">
        <Setter Property="tm:SetterBinding.Setters">
            <Setter.Value>
                <SetterBaseCollection>
                    <Setter Property="AutomationProperties.Name">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:contentTitle.System_Search_Contents" />
                        </Setter.Value>
                    </Setter>
                </SetterBaseCollection>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="Resources.Shared.AppStore.AutomationGridViewItemStyle"
           TargetType="GridViewItem"
           BasedOn="{CustomResource Resources.Shared.NestedGridViewItemStyle}">
        <Setter Property="tm:SetterBinding.Setters">
            <Setter.Value>
                <SetterBaseCollection>
                    <Setter Property="AutomationProperties.Name">
                        <Setter.Value>
                            <tm:SetterBinding Path="Extended:title.System_Search_Contents" />
                        </Setter.Value>
                    </Setter>
                </SetterBaseCollection>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>