<Page xmlns:local="clr-namespace:ForzaUI"
      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_QuickUpgradeSelect"
      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_Carousel_QuickUpgradeSelectContent">
                <Grid>
                    <local:FZMaterial x:Name="Icon" Style="{StaticResource A_Style_FZMaterial_Carousel_DefaultItemContent}"
                        ImageSource="{Binding CarImagePath}" Stretch="UniformToFill">
                    </local:FZMaterial>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <!-- 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>


        <Border x:Name="LayoutRoot" Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="VisualStateGroup">
                    <VisualState x:Name="DefaultState"/>
                    <VisualState x:Name="NoClassSelectState">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MainContent" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid x:Name="MainContent">
                <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                    <ContentControl x:Name="ContentControl_SceneTitle"
                                    Content="{local:Loc MainMenu.IDS_Easy_Upgrade}"
                                    Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                    local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Upgrades.png"
                                    HorizontalAlignment="Left" DockPanel.Dock="Top"/>

                    <ContentControl Template="{StaticResource A_Template_ContentControl_SelectorContainer_PageButtons}"
                                    DockPanel.Dock="Bottom"
                                    HorizontalAlignment="Left"
                                    Margin="0,5,0,0"
                                    Panel.ZIndex="1">
                        <local:WrapListBox x:Name="UpgradesList"
                                             ItemsSource="{Binding Collection}"
                                             Style="{StaticResource A_Style_Carousel_7Item}"
                                             ItemTemplate="{StaticResource A_DataTemplate_Carousel_QuickUpgradeSelectContent}" />
                    </ContentControl>

                    <ContentControl Template="{StaticResource A_ControlTemplate_SidePanel}"
                                    DockPanel.Dock="Left"
                                    DataContext="{Binding SelectedItem, ElementName=UpgradesList}"
                                    Width="346"
                                    HorizontalAlignment="Left"
                                    Tag="{Binding ClassID, Converter={StaticResource A_CarClassConverter}, ConverterParameter=longname}">
                        <Decorator Margin="24">
                            <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_UpgradesDescription}"
                                                   AnimationContext="{Binding Description}"/>
                        </Decorator>
                    </ContentControl>
                </DockPanel>
            </Grid>
        </Border>
    </Grid>
</Page>