<DataTemplate 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="Multimedia.ImageGridRelatedSearch.Fallback">
    <ContentControl Name="Home"
                  HorizontalContentAlignment="Stretch"
                  VerticalContentAlignment="Stretch"
                  Content="{Binding}">
        <ContentControl.Resources>
            <DataTemplate x:Key="Multimedia.ImageGridRelatedSearch.Full">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="115" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Border Background="{ThemeResource ImmersiveLightPlaceholderBackgroundBrush}">
                        <Image Stretch="UniformToFill"
                               Source="{Binding Extended:thumbnail.Extended:src}"
                               AutomationProperties.AutomationId="Image.Multimedia.ImageGridRelatedSearch" />
                    </Border>

                    <Border Grid.Row="1"
                            Background="{CustomResource HeroAccent0ImmersiveStartBackground}">
                        <TextBlock Margin="20, 8, 20, 7"
                                   TextWrapping="Wrap"
                                   TextTrimming="WordEllipsis"
                                   Style="{CustomResource TextStyle_Normal_SemiLight}"
                                   Foreground="{ThemeResource ImmersiveSaturatedPrimaryTextBrush}"
                                   tm:RichText.Text="{Binding Extended:text.System_Search_Contents}"
                                   AutomationProperties.AutomationId="Title.Multimedia.ImageGridRelatedSearch" />
                    </Border>
                </Grid>
            </DataTemplate>

            <DataTemplate x:Key="Multimedia.ImageGridRelatedSearch.VerticalLarge">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="95" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Border Background="{ThemeResource ImmersiveLightPlaceholderBackgroundBrush}">
                        <Image Stretch="UniformToFill"
                               Source="{Binding Extended:thumbnail.Extended:src}"
                               AutomationProperties.AutomationId="Image.Multimedia.ImageGridRelatedSearch" />
                    </Border>

                    <Border Grid.Row="1"
                            Background="{CustomResource HeroAccent0ImmersiveStartBackground}">
                        <TextBlock Margin="12, 8, 12, 7"
                                   TextWrapping="Wrap"
                                   TextTrimming="WordEllipsis"
                                   Style="{CustomResource TextStyle_Normal_SemiLight}"
                                   Foreground="{ThemeResource ImmersiveSaturatedPrimaryTextBrush}"
                                   tm:RichText.Text="{Binding Extended:text.System_Search_Contents}"
                                   AutomationProperties.AutomationId="Title.Multimedia.ImageGridRelatedSearch" />
                    </Border>
                </Grid>
            </DataTemplate>

            <DataTemplate x:Key="Multimedia.ImageGridRelatedSearch.Snap">
                <Border Background="{CustomResource HeroAccent0ImmersiveStartBackground}">
                    <TextBlock Margin="12, 8, 12, 12"
                               TextWrapping="Wrap"
                               TextTrimming="WordEllipsis"
                               Style="{CustomResource TextStyle_Normal_SemiLight}"
                               Foreground="{ThemeResource ImmersiveSaturatedPrimaryTextBrush}"
                               tm:RichText.Text="{Binding Extended:text.System_Search_Contents}"
                               AutomationProperties.AutomationId="Title.Multimedia.ImageGridRelatedSearch" />
                </Border>
            </DataTemplate>
        </ContentControl.Resources>

        <tm:DisplayModes.HorizontalStoryboard>
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Home"
                                               Storyboard.TargetProperty="ContentTemplate">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{StaticResource Multimedia.ImageGridRelatedSearch.Full}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </tm:DisplayModes.HorizontalStoryboard>
        <tm:DisplayModes.HorizontalLargeStoryboard>
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Home"
                                               Storyboard.TargetProperty="ContentTemplate">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{StaticResource Multimedia.ImageGridRelatedSearch.Full}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </tm:DisplayModes.HorizontalLargeStoryboard>
        <tm:DisplayModes.VerticalStoryboard>
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Home"
                                               Storyboard.TargetProperty="ContentTemplate">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{StaticResource Multimedia.ImageGridRelatedSearch.Full}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </tm:DisplayModes.VerticalStoryboard>
        <tm:DisplayModes.VerticalLargeStoryboard>
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Home"
                                               Storyboard.TargetProperty="ContentTemplate">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{StaticResource Multimedia.ImageGridRelatedSearch.VerticalLarge}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </tm:DisplayModes.VerticalLargeStoryboard>
        <tm:DisplayModes.VerticalNarrowStoryboard>
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Home"
                                               Storyboard.TargetProperty="ContentTemplate">
                    <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{StaticResource Multimedia.ImageGridRelatedSearch.Snap}" />
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </tm:DisplayModes.VerticalNarrowStoryboard>
    </ContentControl>
</DataTemplate>
