<ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI;assembly="
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <local:MappingConverter x:Key="A_Converter_Arrow_ChangeToVisibility" Default="{x:Static Visibility.Visible}">
        <local:MappingConverterEntry Key="0" Value="{x:Static Visibility.Collapsed}" />
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_ChangeToColor" Default="{StaticResource A_Color_Stat_Neutral_Light}">
        <local:MappingConverterEntry Key="-1" Value="{StaticResource A_Color_Stat_Negative}" />
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_Stat_Positive}" />
    </local:MappingConverter>
 
    <!-- Styles -->
    <Style x:Key="A_Style_TextBlock_PerformanceStatsLabelText"
           TargetType="local:FZTextBlock"
           BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Minimum}">
        <Setter Property="Color"
                Value="{StaticResource A_Color_SubHeader_Text}" />
        <Setter Property="HorizontalAlignment"
                Value="Left" />
        <Setter Property="VerticalAlignment"
                Value="Top" />
    </Style>

    <Style x:Key="A_Style_TextBlock_GraphLegendText"
           TargetType="local:FZTextBlock"
           BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Minimum}">
        <Setter Property="Color"
                Value="{StaticResource A_Color_SubHeader_Text}" />
        <Setter Property="HorizontalAlignment"
                Value="Left" />
        <Setter Property="VerticalAlignment"
                Value="Top" />
    </Style>

    <Style x:Key="A_Style_TextBlock_PerformanceStatsDeltaText_Garage"
           TargetType="local:FZTextBlock"
           BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Small}">
        <Style.Triggers>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>-1</System:Int32>
                    <!-- -1 IsDowngrade -->
                </Trigger.Value>
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Stat_Negative}" />
            </Trigger>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>0</System:Int32>
                    <!-- 0 IsNeutral -->
                </Trigger.Value>
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Stat_Neutral_Light}" />
            </Trigger>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>1</System:Int32>
                    <!-- 1 IsUpgrade -->
                </Trigger.Value>
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Stat_Positive}" />
            </Trigger>
        </Style.Triggers>
        <Setter Property="Color"
                Value="{StaticResource A_Color_SubHeader_Text}" />
        <Setter Property="FontSize"
                Value="24" />
        <Setter Property="Stretch"
                Value="Uniform" />
        <Setter Property="StretchDirection"
                Value="DownOnly" />
        <Setter Property="HorizontalAlignment"
                Value="Right" />
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="Preset" 
                Value="{StaticResource A_FZMaterialPreset_Matte}"/>
    </Style>


    <Style x:Key="A_Style_FZMaterial_PerformanceChangeArrow"
           TargetType="local:FZMaterial">
        <Style.Triggers>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>0</System:Int32>
                    <!-- 0 IsNeutral -->
                </Trigger.Value>
                <Setter Property="Color" Value="{DynamicResource A_Color_Stat_Neutral}" />
            </Trigger>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>1</System:Int32>
                    <!-- 1 IsUpgrade -->
                </Trigger.Value>
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <RotateTransform Angle="180" />
                    </Setter.Value>
                </Setter>
                <Setter Property="Data" 
                        Value="{StaticResource A_Geometry_SpinnerArrow}" />
                <Setter Property="Height" 
                        Value="12" />
                <Setter Property="Width"
                        Value="17" />
            </Trigger>
            <Trigger Property="Tag">
                <Trigger.Value>
                    <System:Int32>-1</System:Int32>
                    <!-- 1 IsUpgrade -->
                </Trigger.Value>
                <Setter Property="Data" 
                        Value="{StaticResource A_Geometry_SpinnerArrow}" />
                <Setter Property="Height" 
                        Value="12" />
                <Setter Property="Width"
                        Value="17" />
            </Trigger>
        </Style.Triggers>
        <Setter Property="Data"
                        Value="{StaticResource A_FZGeometry_Default}" />
        <Setter Property="Height"
                        Value="2" />
        <Setter Property="Width"
                        Value="17" />
        <Setter Property="RenderTransformOrigin"
                Value="0.5,0.5" />
    </Style>

    <Style
        x:Key="A_Style_FZMaterial_PerformanceChangeArrowBox"
        TargetType="FZMaterial">
        <Setter
            Property="Color"
            Value="{DynamicResource A_Color_Stat_Neutral_Light}" />
        <Setter
            Property="Preset"
            Value="{StaticResource H_Roundtangle_Outer_1px}" />
        <Style.Triggers>
            <Trigger
                Property="Tag">
                <Trigger.Value>
                    <Int32>1</Int32>
                </Trigger.Value>
                <Setter
                    Property="Color"
                    Value="{StaticResource A_Color_Stat_Negative}" />
            </Trigger>
            <Trigger
                Property="Tag">
                <Trigger.Value>
                    <Int32>-1</Int32>
                </Trigger.Value>
                <Setter
                    Property="Color"
                    Value="{StaticResource A_Color_Stat_Negative}" />
            </Trigger>
            <Trigger
                Property="Tag">
                <Trigger.Value>
                    <Int32>1</Int32>
                </Trigger.Value>
                <Setter
                    Property="Color"
                    Value="{StaticResource A_Color_Stat_Positive}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="H_Style_TemplatedWrapper_PerformanceChangeBox" TargetType="ContentControl">
        <Setter Property="Height" Value="30" />
        <Setter Property="Visibility" Value="Collapsed" />
        <Setter Property="Width" Value="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <FZMaterial
                        Style="{StaticResource A_Style_FZMaterial_PerformanceChangeArrowBox}"
                        Tag="{TemplateBinding Content}">
                        <FZMaterial
                            Style="{StaticResource A_Style_FZMaterial_PerformanceChangeArrow}"
                            Tag="{TemplateBinding Content}" />
                    </FZMaterial>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Content">
                <Trigger.Value>
                    <Int32>0</Int32>
                </Trigger.Value>
                <Setter Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="Content">
                <Trigger.Value>
                    <Int32>-1</Int32>
                </Trigger.Value>
                <Setter Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="Content">
                <Trigger.Value>
                    <Int32>1</Int32>
                </Trigger.Value>
                <Setter Property="Visibility" Value="Visible" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!--To have map the Tag to the correct thread type for usage in a FrameworkElement seperate from the Rank Container. -->
    <Style x:Key="A_Style_FrameworkElement_UserContent_Base" TargetType="FrameworkElement">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Blueprint}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.BlueprintThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Livery}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.LiveryThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Photo}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.PhotoThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Tuning}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.TuningThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Vinyl}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.VinylThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.SuperSeven}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.SuperSevenThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.PropPrefab}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.PropPrefabThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.Estate}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.EstateThread}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Static local:UGCThreadType.GarageLayout}">
                <Setter Property="DataContext" Value="{Binding ThreadLevels.GarageLayoutThread}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZMaterial_RankContainer_Background" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FrameworkElement_UserContent_Base}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"/>
        <Setter Property="Color" Value="#40000000"/>
        <Setter Property="Height" Value="32"/>
    </Style>

    <local:MappingConverter x:Key="A_Converter_ThreadTypeToAlternateIcon" CheckEnumKey="UGCThreadType">
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Blueprint}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/blueprint_events.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Livery}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/liveries.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Photo}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/photos.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Tuning}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/tunes.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Vinyl}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/vinyl_groups.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.SuperSeven}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/community_challenges.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.PropPrefab}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/prop_prefab.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Estate}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/estate.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.GarageLayout}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/garage_layout.png"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_ThreadTypeToIcon" CheckEnumKey="UGCThreadType">
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Blueprint}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Blueprint_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Livery}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Livery_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Photo}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Photo_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Tuning}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Tuning_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Vinyl}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Vinyl_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.SuperSeven}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Super_Seven_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.PropPrefab}" Value="/ForzaUI;component/Textures/Data_Bound/Creator_Level/Prop_Prefab.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.Estate}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/Estate_Rank.png"/>
        <local:MappingConverterEntry Key="{x:Static local:UGCThreadType.GarageLayout}" Value="/ForzaUI;component/Textures/Data_Bound/CreativeHub/GarageLayout_Rank.png"/> 
    </local:MappingConverter>
    
    <Style x:Key="A_Style_UGC_Text_Style" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
        <Setter Property="FontSize" Value="22"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding ThreadValue, Converter={StaticResource A_CompareConverter}, ConverterParameter=49}" Value="1">
                <Setter Property="Color" Value="{StaticResource A_Color_UGC_Alternate_Text_Color}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Null}">
                <Setter Property="Visibility" Value="Hidden"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_StatLabel"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
        <Setter Property="FontFamily"
                        Value="Horizon_B_tf" />
        <Setter Property="CapHeight"
                        Value="16" />
        <Setter Property="Color"
                        Value="{StaticResource H_Color_Primary_Grey_70pc}" />
        <Setter Property="HorizontalAlignment"
                        Value="Left" />
        <Setter Property="VerticalAlignment"
                        Value="Center" />
        <Setter Property="Stretch"
                        Value="Uniform" />
        <Setter Property="StretchDirection"
                        Value="DownOnly" />
        <Setter Property="MaxWidth"
                        Value="200" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_StatInfo"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Small}">
        <Setter Property="CapHeight"
                        Value="15" />
        <Setter Property="Color"
                        Value="{StaticResource H_Color_Primary_White}" />
        <Setter Property="HorizontalAlignment"
                        Value="Left" />
        <Setter Property="VerticalAlignment"
                        Value="Center" />
        <Setter Property="Stretch"
                        Value="Uniform" />
        <Setter Property="StretchDirection"
                        Value="DownOnly" />
        <Setter Property="MaxWidth"
                        Value="200" />
    </Style>

    <Style x:Key="A_Style_TextBlock_BenchmarkSectionHeader"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="CapHeight"
                 Value="18" />
        <Setter Property="Color"
                 Value="{StaticResource H_Color_Primary_White}" />
        <Setter Property="HorizontalAlignment"
                 Value="Left" />
        <Setter Property="VerticalAlignment"
                 Value="Center" />
        <Setter Property="Stretch"
                 Value="Uniform" />
        <Setter Property="StretchDirection"
                 Value="DownOnly" />
        <Setter Property="MaxWidth"
                 Value="200" />
        <Setter Property="Opacity"
             Value="1" />
    </Style>

    <Style x:Key="A_Style_TextBlock_BenchmarkStatValue"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_FZTextBlock_StatInfo}">
        <Setter Property="FontFamily"
                 Value="Horizon_A_tf" />
        <Setter Property="HorizontalAlignment"
                        Value="Right" />
        <Setter Property="TextAlignment"
                        Value="Right" />
    </Style>

    <Style TargetType="local:FZMaterial"
                   x:Key="A_Style_FZMaterial_Change_Arrow"
                   BasedOn="{StaticResource A_Style_FZMaterial_PerformanceChangeArrow}">
        <Setter Property="Height"
                        Value="12" />
        <Setter Property="Width"
                        Value="17" />
    </Style>
    
    <ControlTemplate x:Key="A_ControlTemplate_SidePanel_UpgradeCost" TargetType="ContentControl">
        <ControlTemplate.Resources>
            <local:NumUnitConverter x:Key="A_NumUnitConverter_Units"
                                    FractionDigits="0" />
        </ControlTemplate.Resources>
        <DockPanel>
            <ContentControl DockPanel.Dock="Top" Style="{StaticResource A_Style_ContentControl_Header_Custom}">
                <Grid Width="{TemplateBinding Width}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Decorator ClipToBounds="True" Margin="10,0,10,0" Grid.Column="0">
                        <FZTextBlock Style="{StaticResource H_Style_Text_DescriptionTitle}"
                            Text="{TemplateBinding local:BindingProxy.A}"
                            FontFamily="Horizon_A"
                            Stretch="None"
                            AutoScroll="{StaticResource H_AutoScrollSettings_Horizontal_Title}"
                            AutoScroll.AllowScrolling="True"/>
                    </Decorator>
                    <DockPanel DockPanel.Dock="Right"
                               LastChildFill="False"
                               Grid.Column="1"
                               HorizontalAlignment="Right"
                               Visibility="{Binding SeamlessUpgradesAreFree, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, FallbackValue=Visible}">
                        <StackPanel DockPanel.Dock="Left" 
                                    Orientation="Horizontal"
                                    Visibility="{TemplateBinding local:BindingProxy.B, Converter={StaticResource A_StringVisConverter}}">
                            <FZMaterial x:Name="DiscountPercent"
                                        ImageSourceNoPreload="game:/Media/UI/Textures/Data_Bound/SeeItDriveIt/Aftermarket/Sale_Sticker.png"
                                        Height="30"
                                        MaxWidth="130"
                                        VerticalAlignment="Center"
                                        Visibility="{TemplateBinding BindingProxy.AlwaysValidNumeric, Converter={StaticResource A_Converter_VisibleIfGreaterThanZero}}">
                                <FZMaterial.UVMap>
                                    <FZMaterialUVMap StretchRegion="3,0,12,0"
                                                    UnstretchedSize="19,30" />
                                </FZMaterial.UVMap>
                                <FZTextBlock CapHeight="16"
                                            Color="{StaticResource H_Color_Primary_Black}"
                                            MultiStringFormatter.Param0="{TemplateBinding BindingProxy.AlwaysValidNumeric, Converter={StaticResource A_NumUnitConverter_Units}}"
                                            MultiStringFormatter.Format="{Loc CarFlow.IDS_ShortHand_Sale_Format}"
                                            Text="{Binding (MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                            Margin="7,0,18,0"
                                            VerticalAlignment="Center"
                                            FontFamily="Horizon_A"/>
                            </FZMaterial>
                            <Control Style="{StaticResource H_Style_Control_CreditsIcon}" 
                                     Margin="6,6,-6,6"/>
                            <FZTextBlock Style="{StaticResource H_Style_Text_DescriptionTitle}"
                                     FontFamily="Horizon_A"
                                     Color="{StaticResource H_Color_Primary_Black}"
                                     Margin="10,10"
                                     Text="{TemplateBinding local:BindingProxy.B}"/>
                        </StackPanel>
                        
                        <StackPanel DockPanel.Dock="Right" 
                                    Orientation="Horizontal"
                                    Visibility="{TemplateBinding local:BindingProxy.C, Converter={StaticResource A_StringVisConverter}}">
                            <Control Style="{StaticResource H_Style_Control_CreditsIcon}"/>
                            <FZTextBlock Style="{StaticResource H_Style_Text_DescriptionTitle}"
                                     Color="{StaticResource H_Color_Primary_Black}"
                                     Margin="10,10"
                                     Text="{TemplateBinding local:BindingProxy.C}"/>
                        </StackPanel>
                    </DockPanel>
                    <FZTextBlock Color="{StaticResource H_Color_Primary_Black}"
                                     Margin="10,10"
                                     Visibility="{Binding SeamlessUpgradesAreFree, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                     Text="{local:Loc InGameMarketplace.IDS_Free}"
                                     FontSize="23"
                                     FontFamily="Horizon_B"
                                     Grid.Column="1"
                                     HorizontalAlignment="Right"/>
                </Grid>
            </ContentControl>
            <ContentControl DockPanel.Dock="Top" Content="{TemplateBinding Content}" Template="{DynamicResource A_ControlTemplate_SidePanelContent}" />
        </DockPanel>
    </ControlTemplate>

    <Style x:Key="A_Style_FZMaterial_SeamlessChallenge_BackgroundBase" TargetType="FZMaterial">
        <Setter Property="HorizontalAlignment" Value="Right" />
        <Setter Property="Height" Value="44" />
        <Setter Property="Width" Value="460" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_SeamlessChallenge_Background" TargetType="FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_SeamlessChallenge_BackgroundBase}">
        <Setter Property="Color" Value="{StaticResource H_Color_Glass_Purple_20pc}"/>
        <Setter Property="Preset" Value="{StaticResource H_GlassRoundtangle_3px}" />
    </Style>

    <Style x:Key="A_Style_PIRestrictions" TargetType="{x:Type Control}" BasedOn="{StaticResource H_Style_TemplatedElement_CarClassBadge_White}">
        <Setter Property="local:BindingProxy.A" Value="{Binding SeamlessXAMLCarRestrictions.CarPIMaxRestriction}" />
        <Setter Property="local:BindingProxy.B" Value="{Binding SeamlessXAMLCarRestrictions.CarClassRestriction}" />
        <Setter Property="local:BindingProxy.C" Value="{Binding SeamlessXAMLCarRestrictions.CarPIMinRestriction}" />
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Style.Triggers>
            <!-- when displaying a PI range, B is set to H_InvalidCarClassRestriction - this is the same condition that is used in H_CarClassBadge_Default which changes the Format of the text to be '{0} - {1}' when a range is displayed -->
            <DataTrigger Binding="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource Self}}" Value="{StaticResource H_InvalidCarClassRestriction}">
                <Setter Property="BindingProxy.AlwaysValidNumeric" Value="{StaticResource A_Double_NotificationPopup_WidthForPIRange}"/>
                <Setter Property="Width" Value="auto"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_ChallengeRestrictions" TargetType="FZTextBlock">
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}" />
        <Setter Property="FontFamily" Value="Horizon_A" />
        <Setter Property="CapHeight" Value="20" />
        <Setter Property="Margin" Value="16,0" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_ChallengeRestrictionNotRespectedIcon" TargetType="FZMaterial">
        <Setter Property="Width" Value="26" />
        <Setter Property="Height" Value="24" />
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/Warning_Icon.png" />
        <Setter Property="Margin" Value="0,0,8,0" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_StoryChallenges" TargetType="ContentControl">
        <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,124,96,0">
            <local:FZMaterial x:Name="TimeRemaining" 
                              Style="{StaticResource A_Style_FZMaterial_SeamlessChallenge_BackgroundBase}"
                              Color="{StaticResource H_Color_Primary_Yellow}" 
                              Visibility="{Binding ShowCountdownTimer, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                <Grid VerticalAlignment="Center" Margin="16,0">
                    <StackPanel Orientation="Horizontal"> 
                        <local:FZMaterial Width="30" Height="30" ImageSource="/ForzaUI;component/Textures/Data_Bound/Forza_Events/Clock_Shop.png"/>
                        <Decorator Width="10"/>
                        <local:FZTextBlock Text="{Convert {Loc BucketList.IDS_HUD_TimeRemaining}, Converter={StringToUpper}}" Color="{StaticResource H_Color_Primary_Purple}" FontFamily="Horizon_A" CapHeight="20" VerticalAlignment="Center"/>
                    </StackPanel>
                    <local:FZTextBlock Text="{Binding SeamlessChallengeTimeRemaining}" HorizontalAlignment="Right" VerticalAlignment="Center" Color="{StaticResource H_Color_Primary_Purple}" FontFamily="Horizon_A" CapHeight="20"/>
                </Grid>
            </local:FZMaterial>
            <StackPanel  x:Name="Budget"
                         Orientation="Horizontal" 
                         HorizontalAlignment="Right" 
                         Margin="0,8,0,0" 
                         Visibility="{Binding SeamlessUpgradeBudgetShouldBeShown, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                <FZMaterial x:Name="BudgetNotRespectedIcon"
                            Style="{StaticResource A_Style_FZMaterial_ChallengeRestrictionNotRespectedIcon}"
                            Visibility="{Binding SeamlessUpgradeIsBudgetRespected, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}" />
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SeamlessChallenge_Background}">
                    <DockPanel>
                        <local:FZTextBlock DockPanel.Dock="Right" 
                                           Text="{Binding SeamlessAvailableUpgradeBudget, ConverterParameter=money, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}, FallbackValue=0}"
                                           Style="{StaticResource A_Style_FZTextBlock_ChallengeRestrictions}" 
                                           Color="{StaticResource H_Color_Primary_Yellow}"/>
                        <local:FZTextBlock DockPanel.Dock="Left"
                                           Text="{Convert {Loc BucketList.IDS_DMS_AvailableCreditsForUpgrades}, Converter={StringToUpper}}"
                                           Style="{StaticResource A_Style_FZTextBlock_ChallengeRestrictions}" />
                    </DockPanel>
                </local:FZMaterial>
            </StackPanel>
            <StackPanel x:Name="PIRestrictions"
                        Orientation="Horizontal" 
                        HorizontalAlignment="Right"
                        Margin="0,4,0,0"  
                        Visibility="{Binding SeamlessXAMLCarRestrictions, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                <FZMaterial x:Name="PIRestrictionsNotRespectedIcon"
                            Style="{StaticResource A_Style_FZMaterial_ChallengeRestrictionNotRespectedIcon}"
                            Visibility="{Binding SeamlessUpgradeAreCarRestrictionsRespected, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}" />
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SeamlessChallenge_Background}">
                    <DockPanel>
                        <Control DockPanel.Dock="Right"
                                 Style="{StaticResource A_Style_PIRestrictions}"
                                 Margin="0,2,14,2" />
                        <FZTextBlock DockPanel.Dock="Left"
                                     Text="{Convert {Loc BucketList.IDS_DMS_PIRestriction}, Converter={StringToUpper}}"
                                     Style="{StaticResource A_Style_FZTextBlock_ChallengeRestrictions}" />
                    </DockPanel>
                </local:FZMaterial>
            </StackPanel>
        </StackPanel>
    </ControlTemplate>
    <Style
        x:Key="H_Style_Control_UpgradeGrid_EmptyItemStyle" TargetType="Control"
            BasedOn="{StaticResource H_Style_Control_Carousel_EmptyItemStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="Control">
                    <FZMaterial>
                        <FZMaterial.Style>
                            <Style TargetType="FZMaterial">
                                <Setter Property="Color" Value="{StaticResource H_Color_Glass_Purple_20pc}" />
                                <Setter Property="Preset" Value="{StaticResource H_GlassRoundtangle_2px}" />
                            </Style>
                        </FZMaterial.Style>
                    </FZMaterial>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style
        x:Key="H_Style_Container_UpgradeGrid_Tile"
        TargetType="FZMaterial">
        <Setter
            Property="Color"
            Value="{StaticResource H_Color_Primary_White}" />
        <Setter
            Property="Preset"
            Value="{Roundtangle CornerRadius=2}" />
    </Style>
    <Style
        x:Key="H_Style_Container_UpgradeGrid_Tile_Dark"
        TargetType="FZMaterial">
        <Setter
            Property="Color"
            Value="{StaticResource H_Color_Glass_Purple_40pc}" />
        <Setter
            Property="Preset"
            Value="{StaticResource H_GlassRoundtangle_2px}" />
    </Style>
    <Style x:Key="A_Style_ContentControl_UpgradeGrid_ContainerBackground" TargetType="ContentControl" 
        BasedOn="{StaticResource H_Style_ContentControl_ContainerBackground}">
        <Setter Property="DynamicData.Data">
            <Setter.Value>
                <DynamicDataSource>
                    <DynamicDataItem 
                        Name="ItemBackgroundStyle"
                        DataType="Style"
                        Value="{StaticResource H_Style_Container_UpgradeGrid_Tile}" />
                    <DynamicDataItem 
                        Name="DarkItemBackgroundStyle"
                        DataType="Style"
                        Value="{StaticResource H_Style_Container_UpgradeGrid_Tile_Dark}" />
                </DynamicDataSource>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="H_Style_ContentControl_UpgradeGrid_ContainerStyle" TargetType="ContentControl"
        BasedOn="{StaticResource H_Style_ContentControl_Carousel_ContainerStyle}">
        <Style.Resources>
            <CornerRadius x:Key="A_StrokeHighlight_ContentRadius">2</CornerRadius>
        </Style.Resources>
        <Setter Property="Margin" Value="0,0,4,4"/>
        <Setter Property="DynamicData.Data">
            <Setter.Value>
                <DynamicDataSource>
                    <DynamicDataItem
                        Name="MouseRolloverCornerRadius"
                        DataType="CornerRadius"
                        Value="2" />
                    <DynamicDataItem 
                        Name="ItemBackgroundContainerControlStyle"
                        DataType="Style"
                        Value="{StaticResource A_Style_ContentControl_UpgradeGrid_ContainerBackground}" />
                </DynamicDataSource>
            </Setter.Value>
        </Setter>
    </Style> 
    <Style x:Key="H_Style_UpgradeGrid_Square_3x3" TargetType="WrapListBox"
        BasedOn="{StaticResource H_Style_Carousel_Square_3x3}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource H_Style_ContentControl_UpgradeGrid_ContainerStyle}"/>
        <Setter Property="EmptyItemStyle" Value="{StaticResource H_Style_Control_UpgradeGrid_EmptyItemStyle}"/>
    </Style>
    <Style
        TargetType="Control"
        x:Key="H_Style_TemplatedElement_Basket">
        <Style.Resources>
            <ResourceDictionary>
                <ControlTemplate
                    x:Key="H_Template_Basket_Block"
                    TargetType="ContentControl">
                    <FZMaterial
                        Style="{StaticResource H_Style_Container_GlassHighBlur_Description}">
                        <DockPanel>
                            <FZMaterial
                                Width="28"
                                Height="28"
                                VerticalAlignment="Center"
                                Margin="8"
                                ImageSource="{DynamicDataBinding Icon}"
                                Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={FZBooleanToVisibilityConverter}}"
                                DockPanel.Dock="Left" />
                                <FZTextBlock
                                    Margin="16,10,16,10"
                                    TextAlignment="Right"
                                    FontFamily="Horizon_A">
                                    <FZTextBlock.Style>
                                        <Style TargetType="local:FZTextBlock" BasedOn="{StaticResource H_Style_Text_DescriptionTitle}">
                                            <Setter Property="Text" Value="{Binding Path=Content, RelativeSource={RelativeSource AncestorType={x:Type ContentControl}} }" />
                                            <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                                            <Style.Triggers>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding SeamlessUpgrades, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                                                        <Condition Binding="{Binding SeamlessUpgradesAreFree, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Text" Value="{local:Loc InGameMarketplace.IDS_Free}" />
                                                </MultiDataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </FZTextBlock.Style>
                                </FZTextBlock>
                        </DockPanel>
                    </FZMaterial>
                </ControlTemplate>
                <ControlTemplate
                   x:Key="H_Template_SeamlessBasket_Block"
                   TargetType="ContentControl">
                    <FZMaterial
                        Style="{StaticResource H_Style_Container_GlassHighBlur_Description}"
                        Margin="0,0,0,8">
                        <DockPanel>
                            <Control Style="{StaticResource H_Style_TemplatedElement_CarClassBadge_White}"
                                    DockPanel.Dock="Left"
                                    Height="Auto" Margin="0,0,2,2"
                                    local:BindingProxy.A="{Binding SeamlessNonUpgradedPR, RelativeSource={RelativeSource AncestorType=Page}}"
                                    local:BindingProxy.B="{Binding SeamlessNonUpgradedClassID, RelativeSource={RelativeSource AncestorType=Page}}"
                                    HorizontalAlignment="Right" />
                            <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Change_Arrow}"
                                                HorizontalAlignment="Right"
                                                Margin="0,0,2,2"
                                                Tag="{Binding SeamlessPIChange, RelativeSource={RelativeSource AncestorType=Page}}"
                                                Color="{Binding SeamlessPIChange, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_ChangeToColor}}"
                                                Visibility="{Binding SeamlessPIChange, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_Arrow_ChangeToVisibility}}" />
                                <Control Style="{StaticResource H_Style_TemplatedElement_CarClassBadge_White}"
                                    Height="Auto" Margin="0,0,2,2"
                                    local:BindingProxy.A="{Binding SeamlessUpgradedPR, RelativeSource={RelativeSource AncestorType=Page}}"
                                    local:BindingProxy.B="{Binding SeamlessUpgradedClassID, RelativeSource={RelativeSource AncestorType=Page}}"
                                    HorizontalAlignment="Right" />
                            </StackPanel>
                        </DockPanel>
                    </FZMaterial>
                </ControlTemplate>
            </ResourceDictionary>
        </Style.Resources>
        <Setter
            Property="DataContext"
            Value="{Binding Basket}" />
        <Setter
            Property="Height"
            Value="44" />
        <Setter
            Property="Margin"
            Value="0,4,0,0" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Grid>
                        <UniformGrid
                            Rows="1"
                            UIPageTransitionManager.TransitionIndex="1">
                            <ContentControl
                                Template="{StaticResource H_Template_Basket_Block}"
                                Content="{Binding TotalCreditCost, ConverterParameter=money, FallbackValue=0, Converter={NumUnitConverter ShowUnit=False, FractionDigits=0}}"
                                Visibility="{Binding SeamlessUpgrades, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, RelativeSource={RelativeSource AncestorType=Page}}"
                                Margin="0,0,2,0"
                                x:Name="Credits">
                                <DynamicData.Data>
                                    <DynamicDataSource>
                                        <DynamicDataItem
                                            Name="Icon"
                                            DataType="String"
                                            Value="game:\Media\UI\Textures\Data_Bound\Currency\Credits_Large.png"/>
                                    </DynamicDataSource>
                                </DynamicData.Data>
                            </ContentControl>
                            <ContentControl
                                Template="{StaticResource H_Template_Basket_Block}"
                                Content="{Binding SeamlessUpgradeSpend, ConverterParameter=money, FallbackValue=0, Converter={NumUnitConverter ShowUnit=False, FractionDigits=0}, RelativeSource={RelativeSource AncestorType=Page}}"
                                Visibility="{Binding SeamlessUpgrades, Converter={FZBooleanToVisibilityConverter}, RelativeSource={RelativeSource AncestorType=Page}}"
                                Margin="0,0,2,0"
                                x:Name="SeamlessCredits">
                                <DynamicData.Data>
                                    <DynamicDataSource>
                                        <DynamicDataItem
                                            Name="Icon"
                                            DataType="String"
                                            Value="game:\Media\UI\Textures\Data_Bound\Currency\Credits_Large.png"/>
                                    </DynamicDataSource>
                                </DynamicData.Data>
                            </ContentControl>
                            <UniformGrid
                                Rows="1">
                                <ContentControl
                                    Template="{StaticResource H_Template_Basket_Block}"
                                    Content="{Binding TotalTokenCost, ConverterParameter=tokenmoney, FallbackValue=0, Converter={NumUnitConverter ShowUnit=False, FractionDigits=0}}"
                                    Margin="2,0,2,0"
                                    Visibility="{Binding AreTokensEnabled, Converter={FZBooleanToVisibilityConverter}, Source={StaticResource PART_UISceneContext}}"
                                    x:Name="Tokens">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem
                                                Name="Icon"
                                                DataType="String"
                                                Value="/ForzaUI;component/Textures/Anthem/Icons/Garage/Tokens.png" />
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </ContentControl>
                                <ContentControl
                                    Template="{StaticResource H_Template_Basket_Block}"
                                    Content="{Binding BasketItems.Count, FallbackValue=0, Converter={NumUnitConverter ShowUnit=False, FractionDigits=0}}"
                                    Visibility="{Binding SeamlessUpgrades, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, RelativeSource={RelativeSource AncestorType=Page}}"
                                    Margin="2,0,0,0"
                                    x:Name="Basket">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem
                                                Name="Icon"
                                                DataType="String"
                                                Value="/ForzaUI;component/Textures/Anthem/Icons/Garage/Basket.png" />
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </ContentControl>
                                <ContentControl
                                    Template="{StaticResource H_Template_SeamlessBasket_Block}"
                                    Content="{Binding NumSeamlessUpgrades, FallbackValue=0, Converter={NumUnitConverter ShowUnit=False, FractionDigits=0}, RelativeSource={RelativeSource AncestorType=Page}}"
                                    Visibility="{Binding SeamlessUpgrades, Converter={FZBooleanToVisibilityConverter}, RelativeSource={RelativeSource AncestorType=Page}}"
                                    Margin="2,0,0,0"
                                    x:Name="SeamlessBasket">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem
                                                Name="Icon"
                                                DataType="String"
                                                Value="/ForzaUI;component/Textures/Anthem/Icons/Garage/NumSeamlessUpgrades.png" />
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </ContentControl>
                            </UniformGrid>
                        </UniformGrid>
                        <EventFire
                            x:Name="EventFire" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger
                            Binding="{Binding Updated}">
                            <DataTrigger.Value>
                                <Boolean>True</Boolean>
                            </DataTrigger.Value>
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <StringAnimationUsingKeyFrames
                                            Storyboard.TargetProperty="(EventFire.EventName)"
                                            Storyboard.TargetName="EventFire">
                                            <DiscreteStringKeyFrame
                                                KeyTime="0:0:1.2"
                                                Value="BasketUpdateAnimationComplete" />
                                        </StringAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>