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

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient" BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}" GradientAngle="-90"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_CarGrade_Gradient_Tier_1" BasedOn="{StaticResource A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient}"
        GradientColorA="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"
        GradientColorB="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientB}"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_CarGrade_Gradient_Tier_2" BasedOn="{StaticResource A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient}"
        GradientColorA="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"
        GradientColorB="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientB}"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_CarGrade_Gradient_Tier_3" BasedOn="{StaticResource A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient}"
        GradientColorA="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"
        GradientColorB="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientB}"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_Preset_FZMaterial_CarGrade_Gradient_Tier_4" BasedOn="{StaticResource A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient}"
        GradientColorA="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientA}"
        GradientColorB="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientB}"/>

    <local:MappingConverter x:Key="A_Converter_Grade_To_Preset" Default="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_1}">
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_1}"/>
        <local:MappingConverterEntry Key="2" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_1}"/>
        <local:MappingConverterEntry Key="3" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_1}"/>
        <local:MappingConverterEntry Key="4" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_2}"/>
        <local:MappingConverterEntry Key="5" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_2}"/>
        <local:MappingConverterEntry Key="6" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_2}"/>
        <local:MappingConverterEntry Key="7" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_3}"/>
        <local:MappingConverterEntry Key="8" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_3}"/>
        <local:MappingConverterEntry Key="9" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_3}"/>
        <local:MappingConverterEntry Key="10" Value="{StaticResource A_Preset_FZMaterial_CarGrade_Gradient_Tier_4}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_Grade_To_PresetColor_A" Default="#FFFFFF">
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="2" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="3" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="4" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="5" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="6" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="7" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="8" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="9" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="10" Value="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientA}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_Grade_To_PresetColor_B" Default="#FFFFFF">
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientB}"/>
        <local:MappingConverterEntry Key="2" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientB}"/>
        <local:MappingConverterEntry Key="3" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientB}"/>
        <local:MappingConverterEntry Key="4" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientB}"/>
        <local:MappingConverterEntry Key="5" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientB}"/>
        <local:MappingConverterEntry Key="6" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientB}"/>
        <local:MappingConverterEntry Key="7" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientB}"/>
        <local:MappingConverterEntry Key="8" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientB}"/>
        <local:MappingConverterEntry Key="9" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientB}"/>
        <local:MappingConverterEntry Key="10" Value="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientB}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_Grade_To_BaseColor" Default="#FFFFFF">
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="2" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="3" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA}"/>
        <local:MappingConverterEntry Key="4" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="5" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="6" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA}"/>
        <local:MappingConverterEntry Key="7" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="8" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="9" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA}"/>
        <local:MappingConverterEntry Key="10" Value="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientA}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_Grade_To_BaseColor_Dark" Default="#FFFFFF">
        <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="2" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="3" Value="{StaticResource A_Color_EliminatorCarGrade_Tier1_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="4" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="5" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="6" Value="{StaticResource A_Color_EliminatorCarGrade_Tier2_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="7" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="8" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="9" Value="{StaticResource A_Color_EliminatorCarGrade_Tier3_GradientA_Dark}"/>
        <local:MappingConverterEntry Key="10" Value="{StaticResource A_Color_EliminatorCarGrade_Tier4_GradientA_Dark}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_HUD_CarGradeLevelTexture">
        <local:MappingConverterEntry Key="1" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_1.png" />
        <local:MappingConverterEntry Key="2" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_2.png" />
        <local:MappingConverterEntry Key="3" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_3.png" />
        <local:MappingConverterEntry Key="4" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_4.png" />
        <local:MappingConverterEntry Key="5" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_5.png" />
        <local:MappingConverterEntry Key="6" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_6.png" />
        <local:MappingConverterEntry Key="7" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_7.png" />
        <local:MappingConverterEntry Key="8" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_8.png" />
        <local:MappingConverterEntry Key="9" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_9.png" />
        <local:MappingConverterEntry Key="10" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD/Level_10.png" />
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_HUD_Label_LevelTexture">
        <local:MappingConverterEntry Key="1" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl1.png" />
        <local:MappingConverterEntry Key="2" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl2.png" />
        <local:MappingConverterEntry Key="3" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl3.png" />
        <local:MappingConverterEntry Key="4" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl4.png" />
        <local:MappingConverterEntry Key="5" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl5.png" />
        <local:MappingConverterEntry Key="6" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl6.png" />
        <local:MappingConverterEntry Key="7" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl7.png" />
        <local:MappingConverterEntry Key="8" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl8.png" />
        <local:MappingConverterEntry Key="9" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl9.png" />
        <local:MappingConverterEntry Key="10" Value="/ForzaUI;component/Textures/Data_Bound/Series14/Eliminator/HUD_Label/DriverLabel_lvl10.png" />
    </local:MappingConverter>

    <ControlTemplate x:Key="A_ControlTemplate_EliminatorCarPresenter">
        <Grid x:Name="ItemRoot">
            <Grid VerticalAlignment="Center"  HorizontalAlignment="{DynamicResource A_Dynamic_HorizontalAlignment}"
                  RenderTransform="{DynamicResource A_TransformGroup_HorizontalFlip}" RenderTransformOrigin="0.5, 0.5">
                <local:FZMaterial Height="40" HorizontalAlignment="Stretch">
                    <local:FZMaterial.Preset>
                        <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_Preset_FZMaterial_Base_EliminatorCarGrade_Gradient}"
                                                           GradientColorA="{Binding CarGrade, Converter={StaticResource A_Converter_Grade_To_PresetColor_B}}"
                                                           GradientColorB="{Binding CarGrade, Converter={StaticResource A_Converter_Grade_To_PresetColor_A}}"
                                                           CornerRadius="4,4,4,4"/>
                    </local:FZMaterial.Preset>
                    <Decorator RenderTransform="{StaticResource A_Transform_Italic}" Margin="18,0,86,0">
                        <local:FZTextBlock Text="{Binding CarDisplayName}" VerticalAlignment="Center" HorizontalAlignment="Center" Style="{StaticResource A_Style_FZTextBlock_HudMediumLarge_Tight}"
                                           FontFamily="Horizon_A" FontSize="28"/>
                    </Decorator>
                </local:FZMaterial>
                <local:FZMaterial ImageSourceNoPreload="/ForzaUI;component/Textures/Data_Bound\Series14\Eliminator/HUD/CarGrade_LevelPanel.png"
                                  Height="40" Width="80"  HorizontalAlignment="Right">
                </local:FZMaterial>

                 <!-- Icon needs to escape bounds so it is seperate from top content-->
                <Decorator Margin="0,-12,0,-12" HorizontalAlignment="{DynamicResource A_Dynamic_HorizontalAlignment}" VerticalAlignment="Center">
                    <local:FZMaterial x:Name="PART_Level"
                                      Width="62" Height="68"
                                      ImageSourceNoPreload="{Binding CarGrade, Converter={StaticResource A_Converter_HUD_CarGradeLevelTexture}}"/>
                </Decorator>
            </Grid>
        </Grid>
    </ControlTemplate>

    <Style TargetType="Control" x:Key="A_Style_Control_EliminatorCar_GradeAlignedLeft">
        <Style.Resources>
            <HorizontalAlignment x:Key="A_Dynamic_HorizontalAlignment">Left</HorizontalAlignment>
            <Dock x:Key="A_Dynamic_DockPanel_Dock">Left</Dock>

            <TransformGroup x:Key="A_TransformGroup_HorizontalFlip">
                <ScaleTransform ScaleY="1" ScaleX="-1" />
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Style.Resources>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_EliminatorCarPresenter}"/>
    </Style>

    <Style TargetType="Control" x:Key="A_Style_Control_EliminatorCar_GradeAlignedRight">
        <Style.Resources>
            <HorizontalAlignment x:Key="A_Dynamic_HorizontalAlignment">Right</HorizontalAlignment>
            <Dock x:Key="A_Dynamic_DockPanel_Dock">Right</Dock>

            <TransformGroup x:Key="A_TransformGroup_HorizontalFlip">
                <ScaleTransform ScaleY="1" ScaleX="1" />
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Style.Resources>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_EliminatorCarPresenter}"/>
    </Style>
</ResourceDictionary>