<local:CenterPopup
    x:Class="Bili.App.Controls.PgcPlayListDetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:behaviors="using:Bili.App.Behaviors"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:loc="using:Bili.App.Resources.Extension"
    xmlns:local="using:Bili.App.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pgcControls="using:Bili.App.Controls.Pgc"
    xmlns:pgcInterfaces="using:Bili.ViewModels.Interfaces.Pgc"
    Title="{x:Bind ViewModel.Data.Title, Mode=OneWay}"
    d:DesignHeight="300"
    d:DesignWidth="400"
    mc:Ignorable="d">

    <interactivity:Interaction.Behaviors>
        <behaviors:InitializeBehavior />
    </interactivity:Interaction.Behaviors>

    <Grid RowSpacing="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock
            Style="{StaticResource CaptionTextBlockStyle}"
            HorizontalAlignment="Left"
            Foreground="{ThemeResource TextFillColorSecondaryBrush}"
            Text="{x:Bind ViewModel.Subtitle, Mode=OneWay}"
            TextWrapping="Wrap" />
        <Grid Grid.Row="1">
            <ScrollViewer HorizontalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden">
                <Grid>
                    <local:VerticalRepeaterView
                        x:Name="SeasonView"
                        Margin="0,0,0,12"
                        Background="Transparent"
                        HeaderVisibility="Collapsed"
                        ItemOrientation="Horizontal"
                        ItemsSource="{x:Bind ViewModel.Seasons}"
                        Visibility="{x:Bind ViewModel.IsReloading, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}">
                        <local:VerticalRepeaterView.ItemTemplate>
                            <DataTemplate x:DataType="pgcInterfaces:ISeasonItemViewModel">
                                <pgcControls:SeasonItem Style="{StaticResource SlimSeasonItemStyle}" ViewModel="{x:Bind}" />
                            </DataTemplate>
                        </local:VerticalRepeaterView.ItemTemplate>
                    </local:VerticalRepeaterView>
                </Grid>
            </ScrollViewer>
            <local:OverlayLoadingPanel MinHeight="80" IsRingActive="{x:Bind ViewModel.IsReloading, Mode=OneWay}" />
            <local:ErrorPanel
                x:Name="ErrorPanel"
                ActionContent="{loc:Locale Name=Refresh}"
                Text="{x:Bind ViewModel.ErrorText, Mode=OneWay}"
                Visibility="{x:Bind ViewModel.IsError, Mode=OneWay}">
                <interactivity:Interaction.Behaviors>
                    <behaviors:ReloadBehavior />
                </interactivity:Interaction.Behaviors>
            </local:ErrorPanel>
        </Grid>
    </Grid>
</local:CenterPopup>
