<Page x:Class="ForzaUI.Scenes.Anthem.A_OnlineAdventurePlayerSettings"
      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}}">
    
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Popup}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <System:Double x:Key="A_Double_PanelWidth">700</System:Double>
            <System:Double x:Key="A_Double_InternalItemWidth">650</System:Double>

            <Style x:Key="A_Style_ListBoxItem_TextMenu_Setting" 
                   TargetType="{x:Type ListBoxItem}" 
                   BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}">
                <Setter Property="Visibility" Value="Visible" />
                <Setter Property="Height" Value="{StaticResource A_Double_TextMenu_Height_Default}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <ListBoxItem x:Name="ListBoxItem"  Template="{StaticResource A_ControlTemplate_TextMenu_Default}" Focusable="False">
                                <local:SpinnerControl x:Name="Spinner" Label="{Binding Name}"
                                                         Style="{StaticResource A_Style_SpinnerControl_Default_InItemsList}"
                                                         ItemsSource="{Binding Options}" SelectedItem="{Binding SelectedValue, Mode=TwoWay}" WrapSelection="{Binding WrapSelection}"/>
                            </ListBoxItem>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_FZButton_LeftAlignment_TextButton_Option" TargetType="local:FZButton">
                <Style.Resources>
                    <Style x:Key="A_Style_FZTextBlock_ButtonText_Dynamic" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SpinnerItem}">
                        <Setter Property="HorizontalAlignment" Value="Left"/>
                        <Setter Property="Margin" Value="16,0,0,0"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                    </Style>
                </Style.Resources>
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_Button_TextMenu}"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

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

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

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

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

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}" Tag="/ForzaUI;component/Textures/Anthem/Icons/Titles/PopupMessageBox.png">
                    <StackPanel Orientation="Vertical" Width="{StaticResource A_Double_InternalItemWidth}" KeyboardNavigation.DirectionalNavigation="Contained">
                        <local:FZTextBlock Margin="0,0,0,30" Text="{Binding Message}"
                                               Visibility="{Binding Message, Converter={StaticResource A_StringVisConverter}}"
                                               Style="{StaticResource A_Style_FZTextBlock_PopupText}"/>
                        
                        <local:CommonListBox x:Name="GlobalSettingsMenu"
                                             Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                             ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Setting}"
                                             ItemsSource="{Binding Settings}"
                                             local:FocusOnPageFocusGained.SelectorSelectedItem="True"
                                             KeyboardNavigation.DirectionalNavigation="Continue"/>

                        <local:CommonListBox Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                             ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}"
                                             Focusable="False"
                                             KeyboardNavigation.DirectionalNavigation="Continue">
                            <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}" Visibility="{Binding KickButtonCommand, Converter={StaticResource A_FZBooleanToVisibilityConverter} }">
                                <local:FZButton x:Name="PART_KickButton" Content="{local:Loc Lobby.IDS_UserActionsKickFromSession}" Command="{Binding KickButtonCommand}"
                                            Style="{StaticResource A_Style_FZButton_LeftAlignment_TextButton_Option}"/>
                            </ListBoxItem>
                            <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}" Margin="0, 7, 0, 0">
                                <local:FZButton x:Name="PART_ConfirmButton" Content="{local:Loc PopupOptions.IDS_Confirm}" Command="{Binding ConfirmButtonCommand}"
                                            Template="{StaticResource A_ControlTemplate_Button_TextMenu}" />
                            </ListBoxItem>
                        </local:CommonListBox>
                    </StackPanel>
                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
