<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" 
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.A_SellSheet"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Margin="0">
    <Page.Resources>
        <ResourceDictionary>
            <Style x:Key="A_Style_Icon" TargetType="local:FZMaterial">
                <Setter Property="Width" Value="68"/>
                <Setter Property="Height" Value="68"/>
                <Setter Property="Stretch" Value="Uniform"/>
            </Style>

            <Color x:Key="A_Color_Team_Adventure_Series">#FF00E59E</Color>

            <!-- Scene based Color Converter-->
            <local:MappingConverter x:Key="A_Scene_Color_Converter">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}" Value="{x:Null}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}" Value="{x:Null}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="{StaticResource A_Color_Tile_AlternateBackground}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.CommunityAlertSellSheet}" Value="{StaticResource A_Color_Tile_AlternateBackground}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.ThreadSellSheet}" Value="{StaticResource A_Color_InfluenceThread_streaming}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}" Value="{StaticResource A_Color_Team_Adventure_Series}"/>
            </local:MappingConverter>

            <!---TEXT Styles-->
            <!--Seasonal Events Control. Use uppercase because converter used puts all text in uppercase-->
            <Style x:Key="A_Style_FZRun_BOLD" TargetType="local:FZRun">
                <Setter Property="FontFamily" Value="Horizon_A" />
            </Style>
            <Style x:Key="A_Style_FZRun_HorizonC_BOLD" TargetType="local:FZRun">
                <Setter Property="FontFamily" Value="Horizon_C" />
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheetText" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
                <Setter Property="Color" Value="{StaticResource A_Color_White}"/>
                <Setter Property="FontSize" Value="24"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_Base" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheetText}">
                <Setter Property="TextAlignment" Value="Center"/>
                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_FZRun_"/>
                <Setter Property="CapHeight" Value="76"/>
                <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
                <Setter Property="LineHeight" Value="86"/>
                <Setter Property="FontFamily" Value="Horizon_A"/>
                <Setter Property="MaxHeight" Value="150"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_Default" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Base}">
                <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding ScreenTitle, Converter={StaticResource A_StringToUpper}}"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_Patchnotes" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Default}">
                <Setter Property="CapHeight" Value="58"/>
                <Setter Property="TextWrapping" Value="NoWrap"/>
                <Setter Property="Margin" Value="0,32,0,0"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_Threads" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Default}">
                <Setter Property="CapHeight" Value="36"/>
                <Setter Property="LineHeight" Value="50"/>
                <Setter Property="LineAdjust" Value="-0.5"/>
                <Setter Property="FontFamily" Value="Horizon_B"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_Season" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Default}">
                <Setter Property="Color" Value="{Binding Season, Converter={StaticResource A_Converter_Season_To_Color}}"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_Title_TeamAdventure" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Base}">
                <Setter Property="Text" Value="{local:Loc ScreenTitles.IDS_SellSheet_Team_Adventure}"/>
                <Setter Property="FontFamily" Value="Horizon_B"/>
                <Setter Property="CapHeight" Value="38"/>
                <Setter Property="LineHeight" Value="56"/>
            </Style>

            <local:MappingConverter x:Key="A_Scene_Title_Converter" Default="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Default}">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Season}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Season}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Patchnotes}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.ThreadSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_Title_Threads}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_Title_TeamAdventure}"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_Base" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheetText}">
                <Setter Property="TextAlignment" Value="Center"/>
                <Setter Property="CapHeight" Value="36"/>
                <Setter Property="FontFamily" Value="Horizon_B"/>
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="Margin" Value="0,12,0,0"/>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_Default" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Base}">
                <Setter Property="Visibility" Value="Visible"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_Season" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Default}">
                <Setter Property="Text" Value="{local:Loc PauseMenu.IDS_Whats_New_This_Season}"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_Thread" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Default}">
                <Setter Property="LineAdjust" Value="-0.5"/>
                <Setter Property="Color" Value="{Binding ThreadName, Converter={StaticResource A_Converter_InfluenceThreadIdToColor}}"/>
                <Setter Property="FontFamily" Value="Horizon_A"/>
                <Setter Property="CapHeight" Value="76"/>
                <Setter Property="Text" Value="{Binding ThreadRankText}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ThreadName}" Value="streaming">
                        <Setter Property="Color" Value="{StaticResource A_Color_InfluenceThread_streaming_light}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_Large" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Default}">
                <Setter Property="FontFamily" Value="Horizon_A"/>
                <Setter Property="CapHeight" Value="92"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_SubTitle_TeamAdventure" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Large}">
                <Setter Property="Text" Value="{Binding AdventureSeriesTitle}"/>
                <Setter Property="Color" Value="{StaticResource A_Color_Team_Adventure_Series}"/>
            </Style>

            <local:MappingConverter x:Key="A_Scene_SubTitle_Converter" Default="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Base}">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Season}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Season}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Default}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.ThreadSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_Thread}"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}" Value="{StaticResource A_Style_FZTextBlock_SellSheet_SubTitle_TeamAdventure}"/>
            </local:MappingConverter>
            
            <Style x:Key="A_Style_FZTextBlock_SellSheet_Description" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheetText}">
                <Setter Property="FontSize" Value="29"/>
                <Setter Property="FontFamily" Value="Horizon_D"/>
                <Setter Property="TextAlignment" Value="Center"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="MaxHeight" Value="84"/>
                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_FZRun_HorizonC_"/>
                <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding ScreenDescription}"/>
                <Setter Property="Margin" Value="138,0,138,0"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                        <Setter Property="Width" Value="1155"/>
                        <Setter Property="FontSize" Value="26"/>
                        <Setter Property="MaxHeight" Value="50"/>
                        <Setter Property="Margin" Value="138,-16,138,0"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            
            <Style x:Key="A_Style_FZTextBlock_SellSheet_ItemTitle" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheetText}">
                <Setter Property="FontSize" Value="42"/>
                <Setter Property="FontFamily" Value="Horizon_B"/>
                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_FZRun_"/>
            </Style>
            <Style x:Key="A_Style_FZTextBlock_SellSheet_ItemDescription" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheetText}">
                <Setter Property="CapHeight" Value="15"/>
                <Setter Property="FontFamily" Value="Horizon_D"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_FZRun_"/>
            </Style>
            
            <!-- Material Styles-->
            <Style x:Key="A_Style_FZMaterial_ColorBar" TargetType="local:FZMaterial">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="Color" Value="{Binding SceneEnum, Converter={StaticResource A_Scene_Color_Converter}}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}">
                        <Setter Property="Color" Value="{Binding Season, Converter={StaticResource A_Converter_Season_To_Color}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}">
                        <Setter Property="Color" Value="{Binding Season, Converter={StaticResource A_Converter_Season_To_Color}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.ThreadSellSheet}">
                        <Setter Property="Color" Value="{Binding ThreadName, Converter={StaticResource A_Converter_InfluenceThreadIdToColor}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.ThreadSellSheet}"/>
                            <Condition Binding="{Binding ThreadName}" Value="streaming"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Color" Value="{StaticResource A_Color_InfluenceThread_streaming_light}"/>
                    </MultiDataTrigger>

                    <!-- series 21 Hack -->
                    <DataTrigger Binding="{Binding UsePromoColor}" Value="{StaticResource A_Boolean_True}">
                        <Setter Property="Color" Value="#FF6BFF"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <local:MappingConverter x:Key="A_Converter_ActiveTrackToNewTextureLocation" Default="/ForzaUI;component/Textures/">
                <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.ExpansionOne}" Value="/ForzaUI;component/Textures/Data_Bound/PDLC1/SellSheet/Icons/New/EN/"/>
            </local:MappingConverter>
            
            <Style x:Key="A_Style_FZMaterial_DLC_NewTexture" TargetType="local:FZMaterial">
                <Setter Property="Color" Value="#FFFFFF" />
                <Setter Property="local:MultiStringFormatter.Format" Value="{StaticResource A_String_01FormatString}" />
                <Setter Property="local:MultiStringFormatter.Param0" Value="{Binding ActiveTrack, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_ActiveTrackToNewTextureLocation}}" />
                <Setter Property="local:MultiStringFormatter.Param1" Value="New.png" />
                <Setter Property="ImageSource" Value="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}" />
                <Setter Property="Visibility" Value="Collapsed"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ActiveTrack, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Static local:XAMLTrack.ExpansionOne}">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Event_Activity" TargetType="Control">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <Grid Width="174" Height="174" VerticalAlignment="Center">
                                <local:FZMaterial ImageSource="{Binding Icon}" Stretch="Uniform">
                                    <Grid Visibility="{Binding ShowNew, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                        <Decorator x:Name="New_Text" MaxWidth="56" VerticalAlignment="Bottom" Margin="0,0,0,46" HorizontalAlignment="Center" Visibility="Collapsed">
                                            <local:FZTextBlock Text="{local:Loc InGame.IDS_New}" Color="#FF484620" HorizontalAlignment="Center" FontSize="21" VerticalAlignment="Center" />
                                        </Decorator>

                                        <local:FZMaterial x:Name="LocalisedNewTextImage" Style="{StaticResource A_Style_FZMaterial_DLC_NewTexture}"/>
                                    </Grid>
                                </local:FZMaterial>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding ActiveTrack, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:XAMLTrack.Default}">
                                    <Setter TargetName="New_Text" Property="Visibility" Value="Visible"/>
                                    <Setter TargetName="LocalisedNewTextImage" Property="Visibility" Value="Collapsed"/>
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            
            <!--Item Template for Sell sheet Event Item-->
            <DataTemplate DataType="{x:Type local:SellSheetActivityItem}">
                <DockPanel Width="700" Height="108" Margin="0,34,0,0">
                    <Decorator DockPanel.Dock="Right"  Width="530">
                        <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
                            <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding Title}" Style="{StaticResource A_Style_FZTextBlock_SellSheet_ItemTitle}"/>
                            <Decorator VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="0,16,0,0" MaxHeight="48" >
                                <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding Description}" MaxHeight="58" VerticalAlignment="Center"
                                               Style="{StaticResource A_Style_FZTextBlock_SellSheet_ItemDescription}"/>
                            </Decorator>
                        </StackPanel>
                    </Decorator>
                    <Control Style="{StaticResource A_Style_Event_Activity}"/>
                </DockPanel>
            </DataTemplate>

            <Style x:Key="A_Style_Control_Reward" TargetType="Control">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <Grid Width="174" Height="174" VerticalAlignment="Center">
                                <local:FZMaterial x:Name="RarityColor" Width="94" Height="94" Style="{StaticResource A_Style_FZMaterial_RewardBacking}" >
                                    <local:FZMaterial ImageSource="{Binding RewardType, Converter={StaticResource A_Converter_RewardTypeToIcon}}" Stretch="Uniform" 
                                                      Width="94" Height="94" VerticalAlignment="Bottom"/>
                                </local:FZMaterial>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            
            <!--Item Template for Sell sheet Reward Item-->
            <DataTemplate DataType="{x:Type local:SellSheetRewardItem}">
                <DockPanel Width="700" Height="108" Margin="0,34,0,0">
                    <Decorator DockPanel.Dock="Right"  Width="530">
                        <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
                            <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding RewardType, Converter={StaticResource A_Converter_RewardTypeToNewString}}" Style="{StaticResource A_Style_FZTextBlock_SellSheet_ItemTitle}" FontFamily="Horizon_A"/>
                            <Decorator Height="18"/>
                            <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding Description}" Margin="0,0,24,0" Style="{StaticResource A_Style_FZTextBlock_SellSheet_ItemDescription}"/>
                        </StackPanel>
                    </Decorator>
                    <Control Style="{StaticResource A_Style_Control_Reward}"/>
                </DockPanel>
            </DataTemplate>

            <Style x:Key="A_Style_FZTextblock_CommunityUpdate_TitleText" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_ItemTitle}">
                <Setter Property="FontFamily" Value="Horizon_A"/>
            </Style>
            <Style x:Key="A_Style_FZtextblock_CommunityUpdate_BodyText" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_SellSheet_ItemDescription}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="FontSize" Value="22"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <!--Item Template for CommunityUpdate Item. I use properties to control the item template rather tha creating a new template.-->
            <DataTemplate DataType="{x:Type local:CommunityUpdateItem}">
                <Grid x:Name="Container" Width="700" Height="Auto" VerticalAlignment="Center" HorizontalAlignment="Left">
                    <local:FZMaterial x:Name="BulletPoint" Visibility="Visible" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="12,6,0,0" Width="2" Height="2" />
                    <local:FZTextBlock x:Name="ItemText" local:TextBlockInlineMarkup.Markup="{Binding Text}" Margin="22,0,66,30" Style="{StaticResource A_Style_FZtextblock_CommunityUpdate_BodyText}"/>
                </Grid>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsTitle}" Value="True">
                        <Setter Property="Style" TargetName="ItemText" Value="{StaticResource A_Style_FZTextblock_CommunityUpdate_TitleText}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding BulletPoint}" Value="False">
                        <Setter Property="Margin" TargetName="ItemText" Value="12,0,66,24"/>
                        <Setter Property="Visibility" TargetName="BulletPoint" Value="Collapsed"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="Width" TargetName="Container" Value="Auto"/>
                        <Setter Property="Margin" TargetName="Container" Value="12,0,0,0"/>
                        <Setter Property="Width" TargetName="ItemText" Value="1145"/>
                    </DataTrigger>
                </DataTemplate.Triggers> 
            </DataTemplate>

            <!-- Container Style-->
            <Style x:Key="A_Style_ListBoxItem_SellSheetMenu" TargetType="ListBoxItem">
                <Setter Property="Focusable" Value="False" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                                <ContentPresenter />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- Create custom Scroll viewer to support arrows around our scrolling. -->
            <Style TargetType="local:FZMaterial" x:Key="A_Style_FZMaterial_Arrow_Visibility_Base">
                <Setter Property="Opacity" Value="1"/>
                <Setter Property="Width" Value="18"/>
                <Setter Property="Height" Value="9"/>
                <Setter Property="Data" Value="{StaticResource A_Geometry_SpinnerArrow}" />
            </Style>
            <Style x:Key="A_Style_FZMaterial_Arrow_Top" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_Arrow_Visibility_Base}">
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <ScaleTransform ScaleY="-1" />
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZScrollViewer}}, Path=(local:FZScrollViewer.IsAtTop)}" Value="True">
                        <Setter Property="Opacity" Value="0.5"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_FZMaterial_Arrow_Bottom" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_Arrow_Visibility_Base}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZScrollViewer}}, Path=(local:FZScrollViewer.IsAtBottom)}" Value="True">
                        <Setter Property="Opacity" Value="0.5"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <ControlTemplate x:Key="A_Style_SellSheet_FZScrollViewer" TargetType="{x:Type local:FZScrollViewer}">
                <Grid>
                    <ContentControl Style="{StaticResource A_ContentControl_HorizontalFadeViewer}">
                            <ScrollContentPresenter HorizontalAlignment="Right" CanContentScroll="True"/>
                    </ContentControl>
                    <Grid>
                        <local:FZMaterial x:Name="ScrollUpArrow" Margin="0,-10,0,0" VerticalAlignment="Top"
                                      Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                      Style="{StaticResource A_Style_FZMaterial_Arrow_Top}"/>
                        <ScrollBar x:Name="PART_VerticalScrollBar"
                                Background="{StaticResource A_Brush_ScrollBarBackground}"
                                Foreground="{StaticResource A_Brush_ScrollBarForeground}"
                                HorizontalAlignment="Right"
                                Minimum="0" 
                                Maximum="{TemplateBinding ScrollableHeight}" 
                                ViewportSize="{TemplateBinding ViewportHeight}" 
                                Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
                                Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" 
                                Margin="0, 0, -25, 0"
                                Style="{StaticResource A_Style_ScrollBar_Default}"/>
                        <local:FZMaterial x:Name="ScrollDownArrow" Margin="0,0,0,-20" VerticalAlignment="Bottom"
                                      Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                      Style="{StaticResource A_Style_FZMaterial_Arrow_Bottom}"/>
                    </Grid>
                </Grid>
            </ControlTemplate>

            <Style x:Key="A_Style_FZMaterial_Background_sheet" TargetType="local:FZMaterial">
                <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/Content_BG.png"/>
                <Setter Property="Width" Value="700"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="Width" Value="1236"/>
                        <Setter Property="MinHeight" Value="600"/>
                        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/Content_BG_PatchNotes.png"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <!--Adjust the item list scroll padding based on the scene we are using. We should be using specific data templates for the items -->
            <local:MappingConverter x:Key="A_MappingConverter_SceneTypeToItemMargin" Default="0,12,0,48">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.ThreadSellSheet}" Value="0,6,0,40"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}" Value="0,6,0,40"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="0,36,0,6"/>
            </local:MappingConverter>

            <!--Adjust the item list max scroll based on the scene we are using. -->
            <local:MappingConverter x:Key="A_MappingConverter_SceneTypeToMaxScrollHeight" Default="496">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.ThreadSellSheet}" Value="336"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}" Value="478"/>
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="600"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_Listbox_SellingItems" TargetType="local:CommonListBox">
                <Setter Property="MaxHeight" Value="{Binding SceneEnum, Converter={StaticResource A_MappingConverter_SceneTypeToMaxScrollHeight}}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="local:CommonListBox">
                            <Grid ClipToBounds="False">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Background_sheet}"/>
                                <local:FZScrollViewer
                                                Template="{StaticResource A_Style_SellSheet_FZScrollViewer}"
                                                VerticalScrollBarVisibility="Auto"
                                                CanContentScroll="True"
                                                KeepSelectionOnScreen="False" Margin="0,3">
                                    <StackPanel Orientation="Vertical" IsItemsHost="True" 
                                                    Margin="{Binding SceneEnum, Converter={StaticResource A_MappingConverter_SceneTypeToItemMargin}}" 
                                                    Focusable="False"/>
                                </local:FZScrollViewer>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_SellSheetMenu}"/>
            </Style>

            <Style x:Key="A_Style_SellSheet_EventCountDownControl" TargetType="{x:Type local:NetworkCountdownControl}" BasedOn="{StaticResource A_Style_EventCountdownControl}">
                <Setter Property="Visibility" Value="Hidden"/>
                <Setter Property="TimerDisplayName" Value="{Binding TimerName}"/>
                <Setter Property="CountdownType" Value="SeasonTimeRemaining"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.TeamAdventureSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="TimerDisplayName" Value="{local:Loc MainMenu.IDS_Series_EndsIn }"/>
                        <Setter Property="CountdownType" Value="SeriesTimeRemaining"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <local:MappingConverter x:Key="A_Converter_Scene_To_Background_Tint" Default="#9A000000">
              <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PatchSellSheet}" Value="#33000000"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_FrameworkElement_Sellsheet_ContentPanel" TargetType="FrameworkElement">
                <Setter Property="Width" Value="936"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="Width" Value="1920"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZMaterial_SellSheet_Icon" TargetType="Control" BasedOn="{StaticResource A_Style_Control_InfluenceProgress_OuterAll}">
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="Width" Value="238"/>
                <Setter Property="Height" Value="238"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.ThreadSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="DataContext" Value="{Binding ThreadProgress}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <local:MappingConverter x:Key="A_Season_Brand_Converter">
                <local:MappingConverterEntry Key="{x:Static local:Season.Spring}" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/BrandTextures/Season/EN/Spring.png"/>
                <local:MappingConverterEntry Key="{x:Static local:Season.Summer}" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/BrandTextures/Season/EN/Summer.png"/>
                <local:MappingConverterEntry Key="{x:Static local:Season.Autumn}" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/BrandTextures/Season/EN/Autumn.png"/>
                <local:MappingConverterEntry Key="{x:Static local:Season.Winter}" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/BrandTextures/Season/EN/Winter.png"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_FZMaterial_Brand_Image" TargetType="local:FZMaterial">
                <Setter Property="Stretch" Value="Uniform"/>
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="Auto"/>
                <Setter Property="Visibility" Value="Hidden"/>
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.ThreadSellSheet}"/>
                            <Condition Binding="{Binding ThreadName}" Value="streaming"/>
                        </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="Width" Value="522"/>
                        <Setter Property="Height" Value="348"/>
                        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/SellSheet/BrandTextures/Mixer_Logo.png"/>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.CurrentSeasonSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="Width" Value="580"/>
                        <Setter Property="Height" Value="348"/>
                        <Setter Property="ImageSource" Value="{Binding Season, Converter={StaticResource A_Season_Brand_Converter}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.NextSeasonSellSheet}">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Setter Property="Width" Value="580"/>
                        <Setter Property="Height" Value="348"/>
                        <Setter Property="ImageSource" Value="{Binding Season, Converter={StaticResource A_Season_Brand_Converter}}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Decorator_Sell_Sheet_Title" TargetType="Decorator">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="MaxWidth" Value="740"/>
                <Setter Property="LayoutTransform" Value="{StaticResource A_Transform_Italic}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum}" Value="{x:Static local:SceneEntryEnum.PatchSellSheet}">
                        <Setter Property="MaxWidth" Value="1080"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_Decorator_Sell_Sheet_SubTitle" TargetType="Decorator" BasedOn="{StaticResource A_Style_Decorator_Sell_Sheet_Title}"/>

            <Style x:Key="A_Style_Decorator_Sell_Sheet_Title_CHS" TargetType="Decorator" BasedOn="{StaticResource A_Style_Decorator_Sell_Sheet_Title}">
                <Setter Property="Margin" Value="0,0,0,20"/>
            </Style>
            <Style x:Key="A_Style_Decorator_Sell_Sheet_Title_JP" TargetType="Decorator" BasedOn="{StaticResource A_Style_Decorator_Sell_Sheet_Title}">
                <Setter Property="Margin" Value="0,0,0,16"/>
            </Style>
            <Style x:Key="A_Style_Decorator_Sell_Sheet_Title_CHT" TargetType="Decorator" BasedOn="{StaticResource A_Style_Decorator_Sell_Sheet_Title}">
                <Setter Property="Margin" Value="0,0,0,20"/>
            </Style>
            <Style x:Key="A_Style_Decorator_Sell_Sheet_Title_KO" TargetType="Decorator" BasedOn="{StaticResource A_Style_Decorator_Sell_Sheet_Title}">
                <Setter Property="Margin" Value="0,0,0,16"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>
    <Grid>
        <Grid x:Name="LayoutRoot" Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Border ClipToBounds="false">
                <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                  ClipToBounds="false">

                    <!--Background Image/video-->
                    <local:FZMaterial ImageSource="{Binding ScreenBackground}" Stretch="UniformToFill"
                                  Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                    <!--Text and image Content resting layer -->
                    <StackPanel Orientation="Horizontal">
                        <local:FZMaterial HorizontalAlignment="Left" Width="12" Style="{StaticResource A_Style_FZMaterial_ColorBar}"/>
                        <Decorator>
                            <Grid Style="{StaticResource A_Style_FrameworkElement_Sellsheet_ContentPanel}">
                                <local:FZMaterial Style="{StaticResource A_Style_FrameworkElement_Sellsheet_ContentPanel}" Color="{Binding SceneEnum, Converter={StaticResource A_Converter_Scene_To_Background_Tint}}"/>
                                <Grid>
                                    <local:FZMaterialGlassCapture />
                                    <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                                        <Decorator Height="{Binding SceneEnum, Converter={StaticResource A_MappingConverter_SceneTypeToMaxScrollHeight}}"
                                                   DockPanel.Dock="Bottom" 
                                                   VerticalAlignment="Top"
                                                   Margin="0,0,0,148">
                                            <StackPanel Orientation="Vertical" VerticalAlignment="Center" >
                                                <local:CommonListBox x:Name="PART_CommonListBox_SellSheetList"
                                                 ItemsSource="{Binding Items}"
                                                 HorizontalAlignment="Center"
                                                 Style="{StaticResource A_Style_Listbox_SellingItems}"/>
                                            </StackPanel>
                                        </Decorator>
                                        <StackPanel Orientation="Vertical" DockPanel.Dock="Top" Margin="0,104,0,0">
                                            <StackPanel Orientation="Vertical">
                                                <Control Style="{StaticResource A_Style_FZMaterial_SellSheet_Icon}" Margin="0,-40,0,36"/>
                                                <StackPanel Orientation="Vertical" MaxHeight="180">
                                                    <Decorator Style="{local:LocalizedResource A_Style_Decorator_Sell_Sheet_Title}">
                                                        <local:FZTextBlock HorizontalAlignment="Center" Style="{Binding SceneEnum, Converter={StaticResource A_Scene_Title_Converter}}"
                                                                            local:ScreenReader.Line="{Binding (local:TextBlockInlineMarkup.Markup), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_TrimInlineMarkup}}"
                                                                            local:ScreenReader.Event="OnLoad"
                                                                            local:ScreenReader.LineType="ScreenTitle" />
                                                    </Decorator>
                                                    <Decorator x:Name="SeasonSubText" Style="{StaticResource A_Style_Decorator_Sell_Sheet_SubTitle}">
                                                        <local:FZTextBlock HorizontalAlignment="Center" Style="{Binding SceneEnum, Converter={StaticResource A_Scene_SubTitle_Converter}}"
                                                                           local:ScreenReader.Line="{Binding Text, RelativeSource={RelativeSource Self}}"
                                                                           local:ScreenReader.Event="OnLoad"
                                                                           local:ScreenReader.LineType="ScreenSubtitle" />
                                                    </Decorator>
                                                </StackPanel>
                                            </StackPanel>
                                            <Decorator Margin="0,38,0,36" VerticalAlignment="Top" DockPanel.Dock="Top">
                                                <local:FZTextBlock HorizontalAlignment="Center" VerticalAlignment="Top" TextWrapping="Wrap"
                                                            Style="{StaticResource A_Style_FZTextBlock_SellSheet_Description}"
                                                            local:ScreenReader.Line="{Binding (local:TextBlockInlineMarkup.Markup), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_TrimInlineMarkup}}"
                                                            local:ScreenReader.Event="OnLoad"
                                                            local:ScreenReader.LineType="ScreenDescription" />
                                            </Decorator>
                                        </StackPanel>
                                    </DockPanel>
                                </Grid>
                            </Grid>
                        </Decorator>
                    </StackPanel>
                </Grid>
            </Border>

            <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}" 
                   VerticalAlignment="Top" 
                   HorizontalAlignment="Right" 
                   Margin="0,80,80,0">
                <local:NetworkCountdownControl Style="{StaticResource A_Style_SellSheet_EventCountDownControl}"
                                       GenerateFormattedString="True"/>
            </Decorator>

            <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}" 
                   VerticalAlignment="Bottom"
                   HorizontalAlignment="Right" 
                   Margin="0,00,80,80">
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Brand_Image}" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
            </Decorator>
        </Grid>
        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
            <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
                <ContentControl x:Name="DefaultHelpPanel"
                                local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                        Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"/>
            </ContentControl>
        </Decorator>
    </Grid>
</Page>
