<Page xmlns:local="clr-namespace:ForzaUI"
      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_SelectUpgradeArea"
      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>
        </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"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Grid x:Name="LayoutRoot">
            <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}"
                    Width="auto">
                <Grid>
                    <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        Content="{local:Loc ScreenTitles.IDS_UpgradeCarMainTitle}"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Upgrades.png"
                                        MaxWidth="1200"
                                        HorizontalAlignment="Left"
                                        DockPanel.Dock="Top"
                                        Margin="0"/>

                        <ContentControl Template="{StaticResource A_Template_ContentControl_SelectorContainer_PageButtons}"
                                               Panel.ZIndex="1"
                                               DockPanel.Dock="Bottom"
                                               Margin="0,12,0,-20">
                            <local:WrapListBox x:Name="PART_ItemList"
                                               Style="{StaticResource A_Style_Carousel_Square_10Item}"
                                               ItemsSource="{Binding Collection}"
                                               SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                               local:RoutedEventCommand.Action="{Binding ElementName=ButtonBarDisableMouseCursorMovement}"
                                               local:RoutedEventCommand.Action2="{Binding ElementName=ButtonBarEnableMouseCursorMovement}" />
                        </ContentControl>

                        <local:RoutedEventCommand x:Name="ButtonBarDisableMouseCursorMovement"
                                                  RoutedEvent="UIElement.MouseEnter"
                                                  Command="{Binding DisableCameraFocus,RelativeSource={RelativeSource AncestorType=Page}}" />
                        <local:RoutedEventCommand x:Name="ButtonBarEnableMouseCursorMovement"
                                                  RoutedEvent="UIElement.MouseLeave"
                                                  Command="{Binding EnableCameraFocus,RelativeSource={RelativeSource AncestorType=Page}}" />

                        <ContentControl Template="{StaticResource A_ControlTemplate_SidePanel}"
                                        DockPanel.Dock="Left"
                                        DataContext="{Binding SelectedItem, ElementName=PART_ItemList}"
                                        Width="346"
                                        Margin="0,12,0,0"
                                        HorizontalAlignment="Left"
                                        Tag="{Binding Name, Converter={StaticResource A_StringToUpper}}">
                            <Decorator Margin="24">
                                <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_UpgradesDescription}"
                                                       AnimationContext="{Binding Description}" />
                            </Decorator>
                        </ContentControl>

                        <ContentControl Style="{StaticResource A_Style_DockPanel_Basket}"
                                        DockPanel.Dock="Right" />

                    </DockPanel>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</Page>