<Page xmlns:local="clr-namespace:ForzaUI;assembly="
      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"
      xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      x:Class="ForzaUI.A_MarketplacePackSelect"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <Page.Resources>
        <ResourceDictionary>

            <System:Double x:Key="A_Double_MarketplacePackSelect_ContentHeight">498</System:Double>

            <Style x:Key="A_Style_Run_MarketplacePackText_THIN"
                TargetType="{x:Type local:FZRun}">
                <Setter Property="FontFamily" Value="Horizon_B"/>
            </Style>

            <!-- ControlTemplates -->
            <DataTemplate x:Key="A_DataTemplate_Carousel_ThumbPathThumbnailItemContent">
                <Grid Name="ItemContainer" Margin="6">
                    <local:FZMaterial x:Name="Icon"
                                      ImageSource="{Binding ThumbPath}"
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"/>
                    <Control Style="{StaticResource A_Style_Control_MarketplaceBlammoOwnedTick}"
                                    Tag="{Binding BlammoType}"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Bottom"
                                    Margin="6,4"/>
                </Grid>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" Value="True">
                        <Setter TargetName="ItemContainer" Property="Margin" Value="0"/>
                        <Setter TargetName="Icon" Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>

            <Style x:Key="A_Style_ContentControl_AvailabilityDisplay" TargetType="{x:Type Control}">
                <Setter Property="Visibility" Value="{Binding DataValue, Converter={StaticResource A_StringVisConverter}}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <StackPanel Name="AvailabilityDisplay">
                                <local:FZMaterial Height="48" Style="{StaticResource A_Style_FZMaterial_FlatPanel_HeaderPanel}">
                                    <local:FZTextBlock Text="{Binding DataTitle}"
                                                       Style="{StaticResource A_Style_FZTextBlock_Heading}" CapHeight="18" VerticalAlignment="Center"
                                                       Margin="24,12" Color="{StaticResource A_Color_Tile_Title_Alternate}"/>
                                </local:FZMaterial>
                                <local:FZMaterial x:Name="MedalPanelIncomplete" Height="70" Width="auto"    
                                                  Color="{StaticResource A_Color_White}"
                                                  Style="{StaticResource A_Style_FZMaterial_FlatPanel_FooterPanel}">
                                    <local:FZTextBlock Name="AvailabilityText"
                                                       Style="{StaticResource A_Style_FZTextBlock_Heading_Regular}"
                                                       HorizontalAlignment="Center"
                                                       VerticalAlignment="Center"
                                                       CapHeight="44"
                                                       Color="{StaticResource A_Color_Tile_Text}"
                                                       Text="{Binding DataValue}"/>
                                </local:FZMaterial>
                            </StackPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_MarketPlaceBlammo_Purchased" TargetType="{x:Type ContentControl}" BasedOn="{StaticResource A_Style_MarketPlaceBlammoWithIcon}">
                <Style.Resources>
                    <Style x:Key="A_Style_BlammoIcon_Dynamic" TargetType="local:FZMaterial">
                        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/Complete_Stamp.png"/>
                        <Setter Property="Width" Value="32"/>
                        <Setter Property="Height" Value="32"/>
                        <Setter Property="Margin" Value="8,0,2,0"/>
                        <Setter Property="HorizontalAlignment" Value="Left"/>
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding BlammoType}" Value="{x:Static local:MarketplaceBlammoType.Purchased}">
                                <Setter  Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>

                    <Style x:Key="A_Style_BlammoText_Dynamic" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_CarSelectCarouseItem_StatusText}">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="Color" Value="{Binding Path=(local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"/>
                        <Setter Property="Margin" Value="12,0"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding BlammoType}" Value="{x:Static local:MarketplaceBlammoType.Purchased}">
                                <Setter Property="Margin" Value="50,0,12,0"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                    
                </Style.Resources>
            </Style>
    
            <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_Transparent_OuterTopOnly"
                CornerRadius="{StaticResource A_CornerRadius_Outer_Top}"/>

            <local:MappingConverter x:Key="A_MappingConverter_SceneEnumToSceneTitle">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.MarketplaceCarPacks}" Value="{local:Loc InGameMarketplace.IDS_CarPacks}" />
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.MarketplaceExpansionPacks}" Value="{local:Loc InGameMarketplace.IDS_ExpansionPacks}"/>
            </local:MappingConverter>

            <local:MappingConverter x:Key="A_MappingConverter_SceneEnumToSceneTitleIcon">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.MarketplaceCarPacks}" Value="/ForzaUI;component/Textures/Anthem/Icons/Titles/Car_Packs.png" />
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.MarketplaceExpansionPacks}" Value="/ForzaUI;component/Textures/Data_Bound/PDLC2/Pause/ScreenTitle_Expansion_Packs.png"/>
            </local:MappingConverter>

        </ResourceDictionary>
    </Page.Resources>

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

    <Grid x:Name="LayoutRoot">
        <!-- Background Blur -->
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

        <!-- 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="Frame"
                Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
            <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                    <StackPanel Margin="3,54,0,0">
                        <Grid VerticalAlignment="Top">
                            <ContentControl x:Name="TitleBlock"
                                            Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            local:BindingProxy.A="{Binding SceneEnum, Converter={StaticResource A_MappingConverter_SceneEnumToSceneTitleIcon}}"
                                            Content="{Binding SceneEnum, Converter={StaticResource A_MappingConverter_SceneEnumToSceneTitle}}"
                                            Tag="{local:Loc ScreenTitles.IDS_Marketplace}"
                                            HorizontalAlignment="Left" />
                        </Grid>

                        <DockPanel x:Name="CenterContent"
                                   LastChildFill="True" Margin="0,0,0,6"
                                   DataContext="{Binding SelectedItem, ElementName=PART_PackList}"
                                   Height="{StaticResource A_Double_MarketplacePackSelect_ContentHeight}">

                            <ContentControl Template="{StaticResource A_ControlTemplate_DescriptionPanel}"
                                            x:Name="RightPanel"
                                            Width="371"
                                            Tag="{local:Loc InGameMarketplace.IDS_Description}"
                                            Content="{Binding Description}"
                                            DockPanel.Dock="Right"
                                            Margin="6,0,3,0">
                            </ContentControl>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}" Width="1380"
                                              Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}">
                                <Grid ClipToBounds="True">
                                    <local:FZMaterial ImageSource="{Binding ImagePath}" Width="1380"
                                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"/>
                                    <DockPanel>
                                        <local:FZMaterial DockPanel.Dock="Top"
                                            Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterTopOnly}"
                                            MaxHeight="174" Width="1380"
                                            Color="#40000000">
                                            <DockPanel Margin="25">
                                                <Control DockPanel.Dock="Right"
                                                    VerticalAlignment="Top"
                                                    HorizontalAlignment="Right"
                                                    Margin="25,0,0,0"
                                                    Style="{StaticResource A_Style_ContentControl_AvailabilityDisplay}"/>
                                                <local:FZTextBlock FontSize="76"
                                                    Margin="-4,0,0,0"
                                                    HorizontalAlignment="Left"
                                                    Color="{StaticResource A_Color_Tile_Title_Alternate}"
                                                    Style="{StaticResource A_Style_FZTextBlock_Heading}"
                                                    local:TextBlockInlineMarkup.Markup="{Binding DisplayNameMarkup, Converter={StaticResource A_StringToUpper}}"
                                                    local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Run_MarketplacePackText_" />
                                            </DockPanel>
                                        </local:FZMaterial>
                                        <Grid Margin="25,25,25,22">
                                            <ContentControl Tag="{Binding BlammoType}"
                                                VerticalAlignment="Bottom"
                                                HorizontalAlignment="Left"
                                                Style="{StaticResource A_Style_MarketPlaceBlammo_Purchased}"/>
                                        </Grid>
                                    </DockPanel>
                                </Grid>
                            </local:FZMaterial>
                        </DockPanel>
                        <ContentControl Template="{StaticResource A_Template_ContentControl_SelectorContainer_PageButtons}"
                                        KeyboardNavigation.DirectionalNavigation="Contained">
                            <local:WrapListBox x:Name="PART_PackList"
                                                 Focusable="False"
                                                 Style="{StaticResource A_Style_Carousel_7Item}"
                                                 ItemsSource="{Binding Collection}"
                                                 ItemTemplate="{StaticResource A_DataTemplate_Carousel_ThumbPathThumbnailItemContent}"
                                                 VerticalAlignment="Bottom" 
                                                 SelectedItem="1"
                                                 local:FocusOnPageFocusGained.SelectorSelectedItem="True"/>
                        </ContentControl>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</Page>
