<Page x:Class="ForzaUI.Scenes.Anthem.A_OptionsPopup"
      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"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      ForzaScene.SelectCommand="{Binding SelectedItem.SelectCommand, ElementName=OptionsList}">
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Popup}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <System:Double x:Key="A_Double_MinPanelWidth">816</System:Double>
            <System:Double x:Key="A_Double_InternalItemWidth">816</System:Double>

            <Style x:Key="A_Style_ListBoxItem_TextMenu_SpinnerSetting" 
                   TargetType="{x:Type ListBoxItem}" 
                   BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_NoGaps}">
                <Setter Property="Height" Value="{StaticResource A_Double_TextMenu_Height_Default}" />
                <Setter Property="Margin" Value="0,0,0,4" />
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_ListBox_OptionsList" TargetType="{x:Type ListBox}">
                <StackPanel IsItemsHost="True" />
            </ControlTemplate>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <!-- Background Blur -->
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>

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

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

                <ContentControl Content="{Binding Title}"
                                Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                Width="Auto"
                                Margin="0,0,0,2"/>

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}"
                                Margin="0,0,0,4"
                                Height="180">
                    <local:FZTextBlock VerticalAlignment="Center"
                                       Text="{Binding SelectedItem.Description.TextDescription, ElementName=OptionsList}"
                                       Visibility="{Binding SelectedItem.Description.TextDescription, ElementName=OptionsList, Converter={StaticResource A_StringVisConverter}}"
                                       Style="{StaticResource A_Style_FZTextBlock_PopupText}"
                                       MaxHeight="136"
                                       Width="768"
                                       AutoScroll="{StaticResource H_AutoScrollSettings_Descriptions}"
                                       AutoScroll.AllowScrolling="True"
                                       Stretch="None" />
                </ContentControl>

                <local:CommonListBox x:Name="OptionsList" Focusable="False"
                                     FocusOnPageFocusGained.SelectorSelectedItem="True"
                                     ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_SpinnerSetting}"
                                     Template="{StaticResource A_ControlTemplate_ListBox_OptionsList}"
                                     ItemsSource="{Binding Options.Options}"
                                     SelectedIndex="0"
                                     Width="{StaticResource A_Double_InternalItemWidth}"
                                     Margin="0,0,0,4"/>
            </StackPanel>
        </Grid>
        <PageInputHandler
            x:Name="SelectButtonInput"
            Command="{Binding SelectedItem.SelectCommand, ElementName=OptionsList}"
            Button="A" />
    </Grid>
</Page>
