<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">

    <CornerRadius x:Key="H_CornerRadius_Level">2,2,2,2</CornerRadius>
    <CornerRadius x:Key="H_CornerRadius_LevelWithPrestige">0,2,2,0</CornerRadius>
    
    <local:MappingConverter x:Key="A_Converter_PrestigeLevelToCornerRadius" Default="{StaticResource H_CornerRadius_LevelWithPrestige}">
        <local:MappingConverterEntry Key="0" Value="{StaticResource H_CornerRadius_Level}" />
    </local:MappingConverter>

    <local:MultiConverter x:Key="A_Converter_PrestigeLevelToCornerRadiusFromXP">
        <local:MultiConverterEntry Converter="{StaticResource A_XPConverter_Prestige}" TargetType="{x:Type System:String}" />
        <local:MultiConverterEntry Converter="{StaticResource A_Converter_PrestigeLevelToCornerRadius}" />
    </local:MultiConverter>

    <local:XPConverter x:Key="A_XPConverter_LevelText"/>

    <Style x:Key="A_Style_FZTextBlock_PlayerLevelText_Base"
           TargetType="{x:Type local:FZTextBlock}"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="CapHeight"
                Value="18" />
        <Setter Property="Text"
                Value="{Binding XP, Converter={StaticResource A_XPConverter_LevelText}}" />
        <Setter Property="Color"
                Value="{Binding XP, Converter={StaticResource A_XPConverter_Text}}" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PlayerLevelText_Leaderboard"
           TargetType="{x:Type local:FZTextBlock}"
           BasedOn="{StaticResource A_Style_FZTextBlock_PlayerLevelText_Base}">
        <Setter Property="CapHeight"
                Value="18" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_PlayerLevel_Base"
                     TargetType="Control">
        <Grid>
            <local:FZMaterial GreedyMeasure="True"
                                  MinWidth="34"
                                  MinHeight="30">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle
                                GradientColorA="{Binding XP, Converter={StaticResource A_XPConverter}}"
                                GradientColorB="{Binding XP, Converter={StaticResource A_XPConverter_ToGradientColorB}}"
                                CornerRadius="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToCornerRadiusFromXP}, FallbackValue={StaticResource H_CornerRadius_Level}}"
                                GradientAngle="90"/>
                </local:FZMaterial.Preset>
            </local:FZMaterial>
            <Viewbox Stretch="Uniform"
                        StretchDirection="Both">
                <Grid MaxWidth="58"
                        Height="30"
                        MinWidth="34"
                        MinHeight="30">
                    <local:FZTextBlock Style="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                        CapHeight="15"
                        Margin="4" />
                </Grid>
            </Viewbox>
        </Grid>
    </ControlTemplate>

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

    <local:MultiConverter x:Key="A_Converter_PrestigeLevelToVisibilityFromXP">
        <local:MultiConverterEntry Converter="{StaticResource A_XPConverter_Prestige}" TargetType="{x:Type System:String}" />
        <local:MultiConverterEntry Converter="{StaticResource A_Converter_PrestigeLevelToVisibility}" />
    </local:MultiConverter>

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

    <local:MultiConverter x:Key="A_Converter_PrestigeLevelToVisibilityFromXP_Inverse">
        <local:MultiConverterEntry Converter="{StaticResource A_XPConverter_Prestige}" TargetType="{x:Type System:String}" />
        <local:MultiConverterEntry Converter="{StaticResource A_Converter_PrestigeLevelToVisibility_Inverse}" />
    </local:MultiConverter>

    <Style x:Key="A_Style_FZMaterial_PrestigeIcon"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Width" Value="12" />
        <Setter Property="Height" Value="12" />
        <Setter Property="ImageSourceNoPreload" Value="/ForzaUI;component/Textures/Data_Bound/PrestigeLevels/Prestige_Star.png" />
        <Style.Triggers>
            <Trigger Property="Tag" Value="Dark">
                <Setter Property="Color" Value="#969696" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PrestigeLevel"
           TargetType="{x:Type local:FZTextBlock}"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="Text" Value="{Binding PrestigeLevel}" />
        <Setter Property="CapHeight" Value="9" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="Color" Value="#FFFFFF" />
        <Style.Triggers>
            <Trigger Property="Tag" Value="Dark">
                <Setter Property="Color" Value="#969696" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_PlayerLevel_HighTier"
                     TargetType="Control">
        <Grid>
            <local:FZMaterial x:Name="TextureForPrestige_Narrow" ImageSource="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                GreedyMeasure="True"
                Visibility="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToVisibilityFromXP}, FallbackValue=Collapsed}">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle CornerRadius="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToCornerRadiusFromXP}, FallbackValue={StaticResource H_CornerRadius_Level}}" />
                </local:FZMaterial.Preset>
            </local:FZMaterial>
            <local:FZMaterial x:Name="TextureForNoPrestige_Wide" ImageSource="{Binding (local:BindingProxy.C), RelativeSource={RelativeSource TemplatedParent}}"
                GreedyMeasure="True"
                Visibility="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToVisibilityFromXP_Inverse}, FallbackValue=Collapsed}">
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle CornerRadius="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToCornerRadiusFromXP}, FallbackValue={StaticResource H_CornerRadius_Level}}" />
                </local:FZMaterial.Preset>
            </local:FZMaterial>
            <Viewbox Stretch="Uniform"
                        StretchDirection="Both">
                <Grid MaxWidth="58"
                            Height="30"
                            MinWidth="34"
                            MinHeight="30">
                    <local:FZTextBlock Style="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                            CapHeight="15"
                            Margin="4" />
                </Grid>
            </Viewbox>
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_Control_PlayerLevel_Base"
           TargetType="Control">
        <Setter Property="Visibility"
                Value="{Binding IsXPIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_PlayerLevel_Base}" />
        <Setter Property="local:BindingProxy.A"
                Value="{StaticResource A_Style_FZTextBlock_PlayerLevelText_Base}" />
        <Setter Property="HorizontalAlignment"
                Value="Stretch" />
        <Setter Property="VerticalAlignment"
                Value="Stretch" />
    </Style>
    
    <Style x:Key="A_Style_Control_PlayerLevel_Tier1"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier2"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier3"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier4"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier5"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier6"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier7"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier8"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier9"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier10"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_PlayerLevel_HighTier}" />
        <Setter Property="local:BindingProxy.B"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Bronze_Short.png" />
        <Setter Property="local:BindingProxy.C"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Bronze_Long.png" />
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier11"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_PlayerLevel_HighTier}" />
        <Setter Property="local:BindingProxy.B"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Silver_Short.png" />
        <Setter Property="local:BindingProxy.C"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Silver_Long.png" />
    </Style>
    <Style x:Key="A_Style_Control_PlayerLevel_Tier12"
           TargetType="Control"
           BasedOn="{StaticResource A_Style_Control_PlayerLevel_Base}">
        <Setter Property="Template"
                Value="{StaticResource A_ControlTemplate_PlayerLevel_HighTier}" />
        <Setter Property="local:BindingProxy.B"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Gold_Short.png" />
        <Setter Property="local:BindingProxy.C"
                Value="/ForzaUI;component/Textures/Anthem/Icons/PlayerLevel/Player_Bar_Gold_Long.png" />
    </Style>

    <local:MappingConverter x:Key="A_Converter_XPTierToControlStyle">
        <local:MappingConverterEntry Key="Tier1" Value="{StaticResource A_Style_Control_PlayerLevel_Tier1}"/>
        <local:MappingConverterEntry Key="Tier2" Value="{StaticResource A_Style_Control_PlayerLevel_Tier2}"/>
        <local:MappingConverterEntry Key="Tier3" Value="{StaticResource A_Style_Control_PlayerLevel_Tier3}"/>
        <local:MappingConverterEntry Key="Tier4" Value="{StaticResource A_Style_Control_PlayerLevel_Tier4}"/>
        <local:MappingConverterEntry Key="Tier5" Value="{StaticResource A_Style_Control_PlayerLevel_Tier5}"/>
        <local:MappingConverterEntry Key="Tier6" Value="{StaticResource A_Style_Control_PlayerLevel_Tier6}"/>
        <local:MappingConverterEntry Key="Tier7" Value="{StaticResource A_Style_Control_PlayerLevel_Tier7}"/>
        <local:MappingConverterEntry Key="Tier8" Value="{StaticResource A_Style_Control_PlayerLevel_Tier8}"/>
        <local:MappingConverterEntry Key="Tier9" Value="{StaticResource A_Style_Control_PlayerLevel_Tier9}"/>
        <local:MappingConverterEntry Key="Tier10" Value="{StaticResource A_Style_Control_PlayerLevel_Tier10}"/>
        <local:MappingConverterEntry Key="Tier11" Value="{StaticResource A_Style_Control_PlayerLevel_Tier11}"/>
        <local:MappingConverterEntry Key="Tier12" Value="{StaticResource A_Style_Control_PlayerLevel_Tier12}"/>
    </local:MappingConverter>

    <local:XPConverter x:Key="A_XPConverter"
                       ColorConverter="{StaticResource A_Converter_XPTierToGradientColorA}"
                       StyleConverter="{StaticResource A_Converter_XPTierToControlStyle}"/>
                       
    <local:XPConverter x:Key="A_XPConverter_ToGradientColorB"
                       ColorConverter="{StaticResource A_Converter_XPTierToGradientColorB}"
                       StyleConverter="{StaticResource A_Converter_XPTierToControlStyle}"/>
                       
    <local:WristbandConverter x:Key="A_WristbandConverter"
                       ColorConverter="{StaticResource A_Converter_XPTierToGradientColorA}"
                       StyleConverter="{StaticResource A_Converter_XPTierToControlStyle}" />

    <local:WristbandConverter x:Key="A_WristbandConverter_ToGradientColorB"
                       ColorConverter="{StaticResource A_Converter_XPTierToGradientColorB}"
                       StyleConverter="{StaticResource A_Converter_XPTierToControlStyle}" />

    <ControlTemplate x:Key="A_ControlTemplate_PlayerLevel_WithPrestige">
        <ControlTemplate.Resources>
            <local:MappingConverter x:Key="A_Converter_PrestigeLevelToWristbandWidth"
                                    Default="45">
                <local:MappingConverterEntry Key="0" Value="65" />
            </local:MappingConverter>

            <local:MultiConverter x:Key="A_Converter_PrestigeLevelToWristbandWidthFromXP">
                <local:MultiConverterEntry Converter="{StaticResource A_XPConverter_Prestige}" TargetType="{x:Type System:String}" />
                <local:MultiConverterEntry Converter="{StaticResource A_Converter_PrestigeLevelToWristbandWidth}" />
            </local:MultiConverter>
        </ControlTemplate.Resources>
        <StackPanel Orientation="Horizontal"
                    HorizontalAlignment="Left"
                    Width="65"
                    Height="30">
            <FZMaterial x:Name="Prestige_Level"
                    Width="20"
                    Color="{StaticResource H_Color_Primary_Black}"
                    Visibility="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToVisibilityFromXP}, FallbackValue=Collapsed}">
                <StackPanel VerticalAlignment="Center"
                        Margin="2,0">
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PrestigeIcon_Leaderboard}"/>
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_PrestigeLevel_Leaderboard}"
                                    Text="{Binding XP, Converter={StaticResource A_XPConverter_Prestige}}" />
                </StackPanel>
            </FZMaterial>
            <Control Style="{Binding XP, Converter={StaticResource A_XPConverter}}"
                local:BindingProxy.A="{StaticResource A_Style_FZTextBlock_PlayerLevelText_Leaderboard}"
                Height="{StaticResource A_Double_PrestigeIcon_Height}"
                Width="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToWristbandWidthFromXP}}"/>
        </StackPanel>
    </ControlTemplate>

    <Style x:Key="A_Style_ContentControl_PlayerLevel_WithPrestige_SheenWrapper" TargetType="{Type ContentControl}">
        <Setter Property="BindingProxy.A" Value="{Binding XP, Converter={StaticResource A_Converter_PrestigeLevelToCornerRadiusFromXP}, FallbackValue={StaticResource H_CornerRadius_Level}}"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_RoundtangleSheenWrapper}"/>
    </Style>
</ResourceDictionary>