<Page x:Class="ForzaUI.Scenes.Anthem.A_PopupPCVideoOption"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">
    
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Popup}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <DataTemplate x:Key="A_DataTemplate_ListBoxItem_OptionItem">
            <DockPanel IsHitTestVisible="False"
                  Height="{StaticResource A_Double_TextMenu_Height_Default}">
                <Control x:Name="CheckBox" VerticalAlignment="Center" DockPanel.Dock="Right" Style="{StaticResource A_Style_Control_Checkbox_Radio}" Tag="{Binding IsCurrentSelection}" />
                <local:FZTextBlock x:Name="TextBlock"
                                   Text="{Binding Name, Converter={StaticResource A_StringToUpper}}"
                                   Style="{StaticResource A_Style_FZTextBlock_OptionText}"
                                   FontFamily="Horizon_A"
                                   HorizontalAlignment="Left"
                                   local:ScreenReader.Event="OnChange"
                                   local:ScreenReader.ControlType="Button"
                                   local:ScreenReader.LineType="SelectedItem"
                                   local:ScreenReader.SelectedNumber="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Converter={StaticResource A_IndexToNumberConverter}}"
                                   local:ScreenReader.SelectedCount="{Binding Items.Count, RelativeSource={RelativeSource AncestorType={x:Type Selector}}, FallbackValue=0}" />
            </DockPanel>

            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
                    <Setter TargetName="TextBlock"
                            Property="local:ScreenReader.Line"
                            Value="{Binding Name}"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>

        <Style x:Key="A_Style_FZRun_Description_Markup_BOLD" TargetType="local:FZRun">
            <Setter Property="FontFamily" Value="Horizon_C"/>
            <Setter Property="Color" Value="{StaticResource H_Color_Primary_Yellow}" />
        </Style>

        <Style x:Key="A_Style_FZRun_Description_Markup_SUPERSCRIPT" TargetType="local:FZRun">
            <Setter Property="SubscriptScale" Value="-0.75" />
            <Setter Property="Converter" Value="{StaticResource A_StringToLower}" />
        </Style>

        <MappingConverter x:Key="A_MappingConverter_Description">
            <MappingConverterEntry Key="{NoCase BOLD}" Value="{StaticResource A_Style_FZRun_Description_Markup_BOLD}" />
            <MappingConverterEntry Key="{NoCase SUPERSCRIPT}" Value="{StaticResource A_Style_FZRun_Description_Markup_SUPERSCRIPT}" />
        </MappingConverter>
    </Page.Resources>

    <Grid>
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>

        <!-- Bars -->
        <ContentControl x:Name="BottomBar"
                            Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="PART_DefaultHelpPanel"
                            local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel x:Name="MainContent"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Width="{StaticResource H_Width_PopUp}"
                        Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                Content="{Binding Title, Converter={StaticResource A_StringToUpper}}" />

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}"
                    Margin="0"
                    Visibility="{Binding Message, Converter={StringVisConverter}}">
                    
                    <Decorator ClipToBounds="True" Margin="24">
                        <FZTextBlock Style="{StaticResource H_Style_Text_Description_Body_16px_Scrolling}"
                            MultiStringFormatter.Format="{Binding Message, Converter={StaticResource A_Converter_TrimInlineMarkup}}"
                            ScreenReader.Line="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                            ScreenReader.Event="OnLoad"
                            ScreenReader.LineType="ScreenDescription"
                            Text="{Binding Message}"
                            MarkupConverter="{StaticResource A_MappingConverter_Description}"
                            Stretch="None"
                            MaxHeight="300"
                            AutoScroll="{StaticResource H_AutoScrollSettings_Descriptions}"
                            AutoScroll.AllowScrolling="True"/>
                    </Decorator>
                </ContentControl>

                <local:CommonListBox x:Name="PopupItems"
                                     Style="{StaticResource A_Style_ListBox_List_Default_ScrollBar}"
                                     ItemsSource="{Binding Collection}"
                                     ScrollViewer.VerticalScrollBarVisibility="{x:Static ScrollBarVisibility.Auto}"
                                     ItemTemplate="{StaticResource A_DataTemplate_ListBoxItem_OptionItem}"
                                     ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Default}"
                                     SelectedItem="{Binding SelectedItem}"
                                     Margin="0"
                                     Height="auto"
                                     MaxHeight="520"
                                     local:FocusOnPageFocusGained.VirtualizingSelectorSelectedItem="True" />
            </StackPanel>
        </Grid>
    </Grid>
</Page>
