<Page DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Style="{StaticResource A_Style_Page_Generic}"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.A_Stats"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Page.Resources>
        <Style TargetType="local:FZTextBlock"
               x:Key="A_Style_FZTextBlock_Stats_Label">
            <Setter Property="FontSize"
                    Value="24" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_Tile_Text}" />
            <Setter Property="TextWrapping"
                    Value="NoWrap" />
            <Setter Property="FontFamily"
                    Value="Horizon_A" />
        </Style>
        <Style TargetType="local:FZTextBlock"
               x:Key="A_Style_FZTextBlock_Stats_Value_Small">
            <Setter Property="Color"
                    Value="{StaticResource A_Color_Tile_Selected}" />
            <Setter Property="CapHeight"
                    Value="50" />
            <Setter Property="FontFamily"
                    Value="Horizon_B" />
            <Setter Property="Color"
                    Value="{StaticResource A_Color_StatsItem_Value}" />
        </Style>

        <Style BasedOn="{StaticResource A_Style_FZTextBlock_Stats_Value_Small}"
               TargetType="local:FZTextBlock"
               x:Key="A_Style_FZTextBlock_Stats_Value">
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Stats_Value_CHS" 
               TargetType="local:FZTextBlock"
               BasedOn="{StaticResource A_Style_FZTextBlock_Stats_Value}">
            <Setter Property="CapHeight" Value="44"/>
        </Style>
        <Style x:Key="A_Style_FZTextBlock_Stats_Value_CHT" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Stats_Value_CHS}"/>

        <Style TargetType="local:FZMaterial"
               x:Key="A_Style_FZMaterial_StatsLabelSeparatorLine">
            <Setter Property="Color"
                    Value="#D9D9D9" />
            <Setter Property="Opacity"
                    Value="1" />
            <Setter Property="Height"
                    Value="2" />
        </Style>
        <Style x:Key="A_Style_CommonListBox_LargeScrollableNoticePanel_Stats" TargetType="{x:Type local:CommonListBox}"
            BasedOn="{StaticResource A_Style_CommonListBox_LargeScrollableNoticePanel}">
            <Setter Property="local:BindingProxy.A">
                <Setter.Value>
                    <Thickness>14,18</Thickness>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Template for each Stat -->
        <ControlTemplate TargetType="Control"
                         x:Key="A_ControlTemplate_Stat">
            <local:FZMaterial Height="138"
                              Margin="6"
                              Style="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}"
                              Width="532">
                <Grid x:Name="StatInfo"  
                      local:ScreenReader.Event="OnChange"
                      local:ScreenReader.ControlType="List"
                      local:ScreenReader.LineType="ItemDescription"
                      local:ScreenReader.Line ="{Binding NarratedStats, RelativeSource={RelativeSource AncestorType=Page}}"
                      Margin="20">

                    <StackPanel Orientation="Vertical"
                                VerticalAlignment="Top">
                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Stats_Label}"
                                           local:TextBlockInlineMarkup.Markup="{Binding ItemTitle}" 
                                           local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_"
                                           Height="17" 
                                           MaxWidth="532"/>
                        <local:FZMaterial Margin="-20,15,-20,0" Style="{StaticResource A_Style_FZMaterial_StatsLabelSeparatorLine}" />
                    </StackPanel>
                    <local:FZTextBlock Style="{local:LocalizedResource A_Style_FZTextBlock_Stats_Value}"
                                       local:TextBlockInlineMarkup.Markup="{Binding ItemValue}"
                                       local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_"
                                       VerticalAlignment="Bottom"
                                       x:Name="ValueText" />
                </Grid>
            </local:FZMaterial>
        </ControlTemplate>

        <!-- Item Style -->
        <Style TargetType="{x:Type ListBoxItem}"
               x:Key="A_Style_ListBoxItem_Stat">
            <Setter Property="FocusVisualStyle"
                    Value="{x:Null}" />
            <Setter Property="IsHitTestVisible"
                    Value="False" />
            <Setter Property="Template"
                    Value="{StaticResource A_ControlTemplate_Stat}" />
        </Style>

        <ItemsPanelTemplate x:Key="A_Panel_Stats">
            <WrapPanel Orientation="Horizontal"
                       Width="1632" Margin="0,-6,0,0"/>
        </ItemsPanelTemplate>


        <Style TargetType="{x:Type local:ItemsSelector}"
                   x:Key="A_Style_Carousel_TabBar_Stats" BasedOn="{StaticResource A_Style_Carousel_ItemList_Virtual_TabBar_Base}">
        </Style>

    </Page.Resources>
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>
    <Grid>
        <!-- Background Blur -->
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <!-- Help Panel -->
        <local:PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                        x:Name="TopBar" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            x:Name="DefaultHelpPanel" />
        </ContentControl>
        <Border Style="{StaticResource A_Style_Border_ScenePadding}"
                x:Name="LayoutRoot">
            <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                <StackPanel HorizontalAlignment="Center"
                            Orientation="Vertical"
                            VerticalAlignment="Stretch">
                    <!-- Title -->
                    <Decorator HorizontalAlignment="Left"
                               Margin="0,50,0,0"
                               Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl Content="{Binding Title}"
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Stats.png"/>
                    </Decorator>
                    <Decorator Focusable="False"
                               HorizontalAlignment="Left"
                               Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                               VerticalAlignment="Top">
                        <StackPanel Focusable="False"
                                    Orientation="Horizontal">
                            <StackPanel.Style>
                                <Style TargetType="StackPanel">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=(ItemsControl.Items).(ItemCollection.Count), ElementName=PART_ItemsSelector_Category, Converter={StaticResource A_CompareConverter}, ConverterParameter=2}"
                                                     Value="-1">
                                            <Setter Property="Visibility"
                                                    Value="Collapsed" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </StackPanel.Style>
                            <local:ItemsSelector x:Name="PART_ItemsSelector_Category"
                                                 Focusable="False"
                                                 ItemsSource="{Binding Categories}"
                                                 SelectedItem="{Binding SelectedCategory}"
                                                 MaxWidth="1656"
                                                 SelectedIndex="0"
                                                 Style="{StaticResource A_Style_Carousel_TabBar_Stats}"
                                                 local:AttachedRoutedEventCommand.RoutedEvent="Selector.SelectionChanged"
                                                 local:AttachedRoutedEventCommand.Command="{Binding CategorySelectionChangedCommand}"/>
                        </StackPanel>
                    </Decorator>
                    <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}" Focusable="False"/>
                        <local:CommonListBox DataContext="{Binding SelectedItem, ElementName=PART_ItemsSelector_Category}"
                                             Height="660"
                                             HorizontalAlignment="Center"
                                             ItemContainerStyle="{StaticResource A_Style_ListBoxItem_Stat}"
                                             ItemsPanel="{StaticResource A_Panel_Stats}"
                                             ItemsSource="{Binding ListData}"
                                             Style="{StaticResource A_Style_CommonListBox_LargeScrollableNoticePanel_Stats}"
                                             VerticalAlignment="Top"
                                             x:Name="PART_CommonListBox_StatsList" />
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Page>
