<Page xmlns:local="clr-namespace:ForzaUI;assembly="
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      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"
      x:Class="ForzaUI.A_SkillSelect"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      >

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="A_DataTemplate_ListBoxItem_Skill">
                <local:FZTextBlock Text="{Binding Name}"
                                    Style="{StaticResource A_Style_FZTextBlock_SpinnerTitle}"
                                    Margin="0,0,0,0"/>
            </DataTemplate>

            <Style TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_SkillCategory_TabBarItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <Grid>
                                <local:RoutedEventCommand x:Name="MouseSelectCategoryRoutedEventCommand"
                                                  RoutedEvent="UIElement.MouseLeftButtonUp"
                                                  Command="{Binding MouseSelectCategoryCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
                                <local:FZButton Content="{Binding Name, Converter={StaticResource A_StringToUpper}}"
                                        Style="{StaticResource A_Style_ContentControl_TabTitle_Default}" 
                                        local:RoutedEventCommand.Action="{Binding ElementName=MouseSelectCategoryRoutedEventCommand}"
                                        OnClickSoundName="/Master/UI/PauseMenu/HZ2_SFX_UI_PauseMenu_ChangeTab_01" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="{x:Type local:ItemsSelector}"
                   x:Key="A_Style_Carousel3ItemList_TabBar">
                <Setter Property="FocusVisualStyle"
                        Value="{StaticResource A_Style_BlankVisualStyle}" />
                <Setter Property="IsTabStop"
                        Value="True" />
                <Setter Property="ClipToBounds"
                        Value="True" />
                <Setter Property="Width"
                        Value="524" />
                <Setter Property="Height"
                        Value="50" />
                <Setter Property="PageSize"
                        Value="1" />
                <Setter Property="ItemContainerStyle"
                        Value="{StaticResource A_Style_ContentControl_SkillCategory_TabBarItem}" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid FocusManager.IsFocusScope="True">
                                <local:VirtualizingScrollPanel Style="{StaticResource A_Style_VirtualizingScrollPanel_MotionBlurScrollPanel_TabTitle}"
                                                               IsItemsHost="True"
                                                               ItemHeight="40"
                                                               ItemWidth="180.5"
                                                               Margin="0,0,0,0"
                                                               Padding="180.5,0,0,0"
                                                               HorizontalAlignment="Center" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <Control Template="{StaticResource A_ControlTemplate_Blueprint_Background}"/>

        <!-- Bars -->
        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <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 x:Name="LayoutRoot">
            <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
                <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                    <StackPanel Orientation="Vertical"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Margin="-4,-34,0,0">
                        <!-- Title -->
                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                            <ContentControl Content="{local:Loc ScreenTitles.IDS_SkillSelect}"
                                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Blueprint.png"
                                            Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            HorizontalAlignment="Left"/>
                        </Decorator>

                        <StackPanel Orientation="Horizontal"
                                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                                    HorizontalAlignment="Left">
                            <local:FZButton VerticalAlignment="Top"
                                    Style="{StaticResource A_Style_Button_TabTitleLB_CarSelect}"
                                    Command="{Binding ScrollPagePrevCommand, ElementName=PART_SkillCategoryList}"
                                    IsEnabled="{Binding CanSelectPrev, ElementName=PART_SkillCategoryList}" />
                            <local:ItemsSelector x:Name="PART_SkillCategoryList"
                                                 Style="{StaticResource A_Style_Carousel3ItemList_TabBar}"
                                                 Focusable="False"
                                                 ItemsSource="{Binding SkillCategories}"/>
                            <local:FZButton VerticalAlignment="Top"
                                    Style="{StaticResource A_Style_Button_TabTitleRB_CarSelect}"
                                    Command="{Binding ScrollPageNextCommand, ElementName=PART_SkillCategoryList}"
                                    IsEnabled="{Binding CanSelectNext, ElementName=PART_SkillCategoryList}" />
                        </StackPanel>

                        <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_2}">
                            <DockPanel Width="426" DockPanel.Dock="Right">
                                <ContentControl Style="{StaticResource A_Style_ContentControl_Header}"
                                                Content="{local:Loc Main.IDS_Description}"
                                                DockPanel.Dock="Top"/>
                                <Grid>
                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}"/>
                                    <Decorator Margin="30,25">
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Body}"
                                                            Color="{StaticResource A_Color_Tile_Text_Alternate}"
                                                            FontSize="22"
                                                            Text="{Binding SelectedItem.Description, ElementName=PART_SkillList}"
                                                            TextWrapping="Wrap"/>
                                    </Decorator>
                                </Grid>
                            </DockPanel>

                            <Grid Width="623" Margin="0,0,54,0">
                                <local:CommonListBox x:Name="PART_SkillList"
                                                     KeyboardNavigation.DirectionalNavigation="Contained"
                                                     Style="{StaticResource A_Style_ListBox_List_Default_ScrollBar}"
                                                     ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Default}"
                                                     ItemTemplate="{StaticResource A_DataTemplate_ListBoxItem_Skill}"
                                                     ItemsSource="{Binding SelectedItem.Skills, ElementName=PART_SkillCategoryList}"
                                                     Height="636"
                                                     AllowMouseWheelScrolling="False"/>
                            </Grid>
                        </DockPanel>
                    </StackPanel>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</Page>
