<local:QuestionPanelBase
    x:Class="Bili.App.Controls.QuestionPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:labs="using:CommunityToolkit.Labs.WinUI"
    xmlns:local="using:Bili.App.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    xmlns:other="using:Bili.Models.App.Other"
    d:DesignHeight="300"
    d:DesignWidth="400"
    mc:Ignorable="d">

    <local:CardPanel IsEnableHoverAnimation="False">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="Common">
                <VisualState x:Name="WideState">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource MediumWindowThresholdWidth}" />
                    </VisualState.StateTriggers>
                </VisualState>
                <VisualState x:Name="NarrowState">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="QuestionScrollView.VerticalScrollMode" Value="Disabled" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid Padding="16,0,16,16">
            <muxc:NavigationView
                x:Name="Nav"
                IsBackButtonVisible="Collapsed"
                IsPaneToggleButtonVisible="False"
                IsSettingsVisible="False"
                MenuItemsSource="{x:Bind ViewModel.QuestionCollection}"
                PaneDisplayMode="Top"
                SelectedItem="{x:Bind ViewModel.CurrentQuestionModule, Mode=TwoWay}">
                <muxc:NavigationView.MenuItemTemplate>
                    <DataTemplate x:DataType="other:QuestionModule">
                        <muxc:NavigationViewItem Content="{x:Bind Name}" Tag="{x:Bind Id}" />
                    </DataTemplate>
                </muxc:NavigationView.MenuItemTemplate>
                <ScrollViewer
                    x:Name="QuestionScrollView"
                    HorizontalScrollMode="Disabled"
                    VerticalScrollBarVisibility="Hidden">
                    <muxc:ItemsRepeater
                        x:Name="QuestionRepeater"
                        Margin="0,12"
                        ItemsSource="{x:Bind ViewModel.CurrentQuestionModule.Questions, Mode=OneWay}">
                        <muxc:ItemsRepeater.ItemTemplate>
                            <DataTemplate x:DataType="other:QuestionItem">
                                <labs:SettingsExpander Header="{x:Bind Title}">
                                    <labs:SettingsExpander.Items>
                                        <labs:SettingsCard>
                                            <labs:SettingsCard.Header>
                                                <TextBlock
                                                    HorizontalAlignment="Left"
                                                    IsTextSelectionEnabled="True"
                                                    LineHeight="24"
                                                    Text="{x:Bind Answer}"
                                                    TextWrapping="Wrap" />
                                            </labs:SettingsCard.Header>
                                        </labs:SettingsCard>
                                    </labs:SettingsExpander.Items>
                                </labs:SettingsExpander>
                            </DataTemplate>
                        </muxc:ItemsRepeater.ItemTemplate>
                        <muxc:ItemsRepeater.Layout>
                            <muxc:StackLayout Spacing="8" />
                        </muxc:ItemsRepeater.Layout>
                    </muxc:ItemsRepeater>
                </ScrollViewer>
            </muxc:NavigationView>
        </Grid>
    </local:CardPanel>
</local:QuestionPanelBase>
