<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Bili.App.Controls"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls">

    <Style TargetType="local:VerticalRepeaterView">
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:VerticalRepeaterView">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Grid Margin="0,0,0,8" Visibility="{TemplateBinding HeaderVisibility}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                Style="{StaticResource SubtitleTextBlockStyle}"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                FontSize="16"
                                Text="{TemplateBinding HeaderText}"
                                TextTrimming="CharacterEllipsis" />

                            <ContentPresenter
                                Grid.Column="1"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center"
                                HorizontalContentAlignment="Stretch"
                                VerticalContentAlignment="Center"
                                Content="{TemplateBinding AdditionalContent}" />
                        </Grid>

                        <muxc:ItemsRepeater
                            x:Name="ItemsRepeater"
                            Grid.Row="1"
                            Margin="0,4,0,0"
                            ItemTemplate="{TemplateBinding ItemTemplate}"
                            ItemsSource="{TemplateBinding ItemsSource}"
                            VerticalCacheLength="{TemplateBinding VerticalCacheSize}"
                            XYFocusKeyboardNavigation="Enabled" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
