<Page x:Class="ForzaUI.Scenes.Anthem.A_AuctionSettings"
      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"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      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>

            <DataTemplate DataType="{x:Type local:SettingItem}">
                <local:SpinnerControl x:Name="Spinner"
                                      Label="{Binding Name}"
                                      Style="{StaticResource A_Style_SpinnerControl_Default_InItemsList}"
                                      ItemsSource="{Binding Options}"
                                      WrapSelection="{Binding WrapSelection}"
                                      SelectedItem="{Binding SelectedValue, Mode=TwoWay}" />
            </DataTemplate>

            <Thickness x:Key="A_Thickness_ConfirmMargin">0,7,0,0</Thickness>

            <DataTemplate DataType="{x:Type local:ConfirmButtonSettingItem}">
                <local:FZButton Command="{Binding ConfirmCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                                Content="{local:Loc PopupOptions.IDS_Confirm}"
                                Template="{StaticResource A_ControlTemplate_Button_TextMenu}"
                                local:AncestorPropertySetter.Type="{x:Type ListBoxItem}"
                                local:AncestorPropertySetter.Property="Margin"
                                local:AncestorPropertySetter.Value="{StaticResource A_Thickness_ConfirmMargin}" />
            </DataTemplate>

            <Style x:Key="A_Style_ListBox_TextMenu_AuctionSettings"
                   TargetType="{x:Type local:CommonListBox}"
                   BasedOn="{StaticResource A_Style_ListBox_TextMenu}">
                <Style.Resources>
                    <!-- Extra bottom margin to include space for the confirm button offset -->
                    <Thickness x:Key="A_Thickness_ListBox_TextMenu_PanelMargin_Dynamic">18,0,18,7</Thickness>
                </Style.Resources>
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>

        <Grid Visibility="{Binding ShowBlur, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
            <local:FZMaterialGlassCapture />
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>
        </Grid>
        <!-- Bars -->
        <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>

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

                <ContentControl Content="{Binding Title, Converter={StaticResource A_StringToUpper}}"
                                Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Options.png" />

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}">
                    <StackPanel>
                        <local:FZTextBlock Text="{Binding Message}"
                                           Style="{StaticResource A_Style_FZTextBlock_PopupText}"
                                           Visibility="{Binding HasMessage, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                        <Decorator Style="{StaticResource A_Style_Decorator_MessageBox_Separator}"
                                   Height="24"/>

                        <local:CommonListBox x:Name="Menu"
                                             Style="{StaticResource A_Style_ListBox_TextMenu_AuctionSettings}"
                                             ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}"
                                             ItemsSource="{Binding Settings}"
                                             SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                             Width="670"
                                             local:FocusOnPageFocusGained.SelectorSelectedItem="True" />
                    </StackPanel>
                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
