<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="Shared.AttributionList_8_1_RP">

    <ItemsControl ItemsSource="{Binding Extended:entry}">

        <ItemsControl.Resources>
            <ControlTemplate x:Key="Local.LinkAttribution"
                             TargetType="ContentControl">
                <Button Command="{Binding Extended:activation.System_ConnectedSearch_ActivateCommand}">
                    <Button.Style>
                        <Style TargetType="Button"
                               BasedOn="{CustomResource Resources.Shared.SaturatedResultButtonStyle}">
                            <Setter Property="Padding"
                                    Value="3, 8"/>
                            <Setter Property="Margin"
                                    Value="-3, -8"/>
                        </Style>
                    </Button.Style>
                    <TextBlock Text="{Binding Extended:activation.System_Search_Contents}"
                               Style="{CustomResource TextStyle_Small_Regular}"
                               Foreground="{ThemeResource ImmersiveSaturatedPrimaryTextBrush}"
                               TextTrimming="WordEllipsis"
                               TextWrapping="NoWrap"/>
                </Button>
            </ControlTemplate>

            <ControlTemplate x:Key="Local.TextAttribution"
                             TargetType="ContentControl">
                <TextBlock tm:RichText.Text="{Binding Extended:text.System_Search_Contents}"
                           Style="{CustomResource TextStyle_Small_Regular}"
                           Foreground="{ThemeResource ImmersiveSaturatedPrimaryTextBrush}"
                           TextTrimming="WordEllipsis"
                           TextWrapping="NoWrap"
                           Opacity="0.6"/>
            </ControlTemplate>

            <tm:SwitchCaseConverter x:Key="Local.AttributionConverter"
                                    Default="{StaticResource Local.LinkAttribution}">
                <tm:SwitchCase Case="{x:Null}"
                               Value="{StaticResource Local.TextAttribution}"/>
            </tm:SwitchCaseConverter>
        </ItemsControl.Resources>

        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>

        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <ContentControl Tag="{Binding Extended:activation.System_ConnectedSearch_ActivateCommand}"
                                Template="{Binding Tag, RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource Local.AttributionConverter}}"
                                IsTabStop="False"/>
            </DataTemplate>
        </ItemsControl.ItemTemplate>

    </ItemsControl>
</DataTemplate>