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

    <Thickness x:Key="A_Thickness_Popularity_StarGaps">0,0,14.5,0</Thickness>
    <Style TargetType="local:FZMaterial"
           x:Key="A_Style_FZMaterial_PopularityStar">
        <Setter Property="Color"
                Value="{StaticResource A_Color_Tile_Title_Alternate}" />
        <Setter Property="Stretch"
                Value="Uniform" />
        <Setter Property="Width"
                Value="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:DeltaProgressBar}}" />
        <Setter Property="Color"
                Value="{StaticResource A_Color_Tile_Title_Alternate}" />
    </Style>
    <Style BasedOn="{StaticResource A_Style_FZMaterial_PopularityStar}"
           TargetType="local:FZMaterial"
           x:Key="A_Style_FZMaterial_PopularityStarBg">
        <Setter Property="ImageSourceNoPreload"
                Value="/ForzaUI;component/Textures/Anthem/Icons/A_Popularity_Star_Large.png" />
        <Style.Triggers>
            <Trigger Property="Tag" Value="Small">
                <Setter Property="ImageSourceNoPreload"
                    Value="/ForzaUI;component/Textures/Anthem/Icons/A_Popularity_Star.png" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style BasedOn="{StaticResource A_Style_FZMaterial_PopularityStar}"
           TargetType="local:FZMaterial"
           x:Key="A_Style_FZMaterial_PopularityStarFg">
        <Setter Property="ImageSourceNoPreload"
                Value="/ForzaUI;component/Textures/Anthem/Icons/A_Popularity_Star_Large.png" />
        <Style.Triggers>
            <Trigger Property="Tag" Value="Small">
                <Setter Property="ImageSourceNoPreload"
                    Value="/ForzaUI;component/Textures/Anthem/Icons/A_Popularity_Star.png" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <!-- Scale = ((Height + HorizontalMargin) * 5) / Width -->
    <local:LinearTransformConverter Scale="6.8"
                                    x:Key="A_RatingConverter" />
    <Style TargetType="{x:Type local:DeltaProgressBar}"
           x:Key="A_Style_DeltaProgressBar_Popularity">
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="Focusable"
                Value="False" />
        <Setter Property="HorizontalAlignment"
                Value="Left" />
        <Setter Property="Height"
                Value="40" />
        <Setter Property="Width"
                Value="{Binding Height, RelativeSource={RelativeSource Self}, Converter={StaticResource A_RatingConverter}}" />
        <Setter Property="MaxValue"
                Value="5" />
        <Setter Property="local:BindingProxy.A"
                Value="{StaticResource A_Color_DeltaProgressBar_Background}"/>
        <Setter Property="local:BindingProxy.B"
                Value="{StaticResource A_Color_DeltaProgressBar_Foreground}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DeltaProgressBar}">
                    <Grid HorizontalAlignment="Center"
                          VerticalAlignment="Center">
                        <StackPanel Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:DeltaProgressBar}}"
                                    HorizontalAlignment="Left"
                                    Orientation="Horizontal"
                                    x:Name="PART_Indicator_Base">
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarBg}"
                                              Color="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarBg}" 
                                              Color="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarBg}" 
                                              Color="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarBg}" 
                                              Color="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PopularityStarBg}" 
                                              Color="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                        </StackPanel>
                        <StackPanel ClipToBounds="True"
                                    Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:DeltaProgressBar}}"
                                    HorizontalAlignment="Left"
                                    Orientation="Horizontal"
                                    Width="{Binding BaseValueWidth, RelativeSource={x:Static RelativeSource.TemplatedParent}}"
                                    x:Name="PART_Indicator_Delta">
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarFg}"
                                              Color="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarFg}" 
                                              Color="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarFg}" 
                                              Color="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Margin="{StaticResource A_Thickness_Popularity_StarGaps}"
                                              Style="{StaticResource A_Style_FZMaterial_PopularityStarFg}" 
                                              Color="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PopularityStarFg}"
                                              Color="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                              Tag="{Binding Tag, RelativeSource={RelativeSource TemplatedParent}}"/>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <MappingConverter x:Key="A_LangStrToDriveTrainLineAdjust" Default="-0.125">
        <MappingConverterEntry Key="CHS" Value="-0.3"/>
        <MappingConverterEntry Key="CHT" Value="-0.35"/>
        <MappingConverterEntry Key="JP" Value="-0.3"/>
    </MappingConverter>

    <!-- Drive Train -->
    <Style BasedOn="{StaticResource A_Style_FZTextBlock_Title_Small}"
           TargetType="local:FZTextBlock"
           x:Key="A_Style_FZTextBlock_DriveType">
        <Setter Property="Color"
                Value="{StaticResource H_Color_Primary_Black}" />
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="FontFamily"
                Value="Horizon_A" />
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="Stretch" 
                Value="Uniform" />
        <Setter Property="StretchDirection"
                Value="DownOnly" />
        <Setter Property="CapHeight"
                Value="21" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_DriveTrainDisplay" TargetType="Control">
        <ControlTemplate.Resources>
            <Style x:Key="A_Dynamic_Style_FZMaterial_DriveTrain_background" TargetType="FZMaterial">
                <Setter Property="Preset" Value="{StaticResource H_Roundtangle_Outer_3px}"/>
            </Style>
        </ControlTemplate.Resources>
        <Grid>
            <local:FZMaterial Style="{DynamicResource A_Dynamic_Style_FZMaterial_DriveTrain_background}"
                              Color="{StaticResource H_Color_Primary_White}"/>
            <Viewbox Stretch="Uniform" StretchDirection="Both">
                <DockPanel Width="268"
                              Height="79"> 
                    <local:FZMaterial x:Name="DriveTrainMaterial"
                                      ImageSource="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_PowertrainConverter}, FallbackValue=/ForzaUI;component/Textures/Data_Bound/Drivetrain_Icons/Drivetrain_NULL.png}"
                                      Stretch="Uniform"
                                      HorizontalAlignment="Left"
                                      GreedyMeasure="True"
                                      Margin="0,9,19,9"
                                      DockPanel.Dock="Right"/>
                    <local:FZTextBlock x:Name="DriveTrainText"
                                            FontFamily="Horizon_A"
                                            Color="{StaticResource H_Color_Primary_Black}"
                                            Text="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_PowertrainConverter}, ConverterParameter=text,   FallbackValue=???}"
                                            CapHeight="36"
                                            LineAdjust="{Binding LangStr, Source={StaticResource PART_UISceneContext}, Converter={StaticResource A_LangStrToDriveTrainLineAdjust}}"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center"/>
                </DockPanel>
            </Viewbox>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource Self}}"
                Value="DriveType">
                <Setter TargetName="DriveTrainMaterial" Property="ImageSource" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_DriveTypeConverter}, FallbackValue=/ForzaUI;component/Textures/Data_Bound/Drivetrain_Icons/Drivetrain_NULL.png}" />
                <Setter TargetName="DriveTrainText" Property="Text" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_DriveTypeConverter}, ConverterParameter=text, FallbackValue=???}" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_FlyerDriveTrainDisplay"
        TargetType="Control">
        <Viewbox Stretch="Uniform" StretchDirection="Both">
            <local:FZMaterial Preset="{StaticResource H_Roundtangle_Outer_3px}"
                              Color="{StaticResource H_Color_Primary_White}"
                              Width="144"
                              Height="40">
                <DockPanel>
                    <local:FZMaterial x:Name="DriveTrainMaterial"
                                      ImageSource="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_PowertrainConverter}, FallbackValue=/ForzaUI;component/Textures/Data_Bound/Drivetrain_Icons/Drivetrain_NULL.png}"
                                      Stretch="Uniform"
                                      HorizontalAlignment="Right"
                                      GreedyMeasure="True"
                                      Margin="3,0"
                                      DockPanel.Dock="Right"/>
                    <local:FZMaterial Color="{StaticResource H_Color_Primary_Purple}"
                                      Preset="{StaticResource H_Roundtangle_Outer_1px}"
                                      Margin="2.5,2.5,0,2.5">
                        <local:FZTextBlock x:Name="DriveTrainText"
                                               Style="{StaticResource A_Style_FZTextBlock_DriveType}"
                                               CapHeight="19"
                                               Text="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_PowertrainConverter}, ConverterParameter=text, FallbackValue=???}"
                                               MaxWidth="51.5"
                                               MaxHeight="27"
                                               LineAdjust="{Binding LangStr, Source={StaticResource PART_UISceneContext}, Converter={StaticResource A_LangStrToDriveTrainLineAdjust}}"
                                               Color="{StaticResource H_Color_Primary_White}"
                                               TextWrapping="WrapWithOverflow"
                                               Margin="4,1"/>
                    </local:FZMaterial>
                </DockPanel>
            </local:FZMaterial>
        </Viewbox>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource Self}}"
                Value="DriveType">
                <Setter TargetName="DriveTrainMaterial" Property="ImageSource" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_DriveTypeConverter}, FallbackValue=/ForzaUI;component/Textures/Data_Bound/Drivetrain_Icons/Drivetrain_NULL.png}" />
                <Setter TargetName="DriveTrainText" Property="Text" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_DriveTypeConverter}, ConverterParameter=text, FallbackValue=???}" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="Control"
           x:Key="A_Style_Control_DriveTrainDisplay">
        <Setter Property="local:BindingProxy.A" Value="{Binding PowertrainID}"/>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_DriveTrainDisplay}"/>
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>


    <Style TargetType="Control"
            x:Key="A_Style_Control_DriveTrainDisplay_VerticalWithWhiteBackground">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Control">
                    <Grid>
                        <local:FZMaterial Color="{StaticResource H_Color_Primary_White}"
                                          Width="80"
                                          Height="70">
                            <DockPanel Margin="2,0,2,2">
                                <local:FZMaterial GreedyMeasure="True"
                                                  ImageSource="{Binding PowertrainID, Converter={StaticResource A_PowertrainConverter}, FallbackValue=/ForzaUI;component/Textures/Data_Bound/Drivetrain_Icons/Drivetrain_NULL.png}"
                                                  DockPanel.Dock="Top"
                                                  Stretch="Uniform"
                                                  Height="32"
                                                  Margin="0,4,0,0"
                                                  HorizontalAlignment="Center"
                                                  RenderTransformOrigin="0.5,0.5">
                                </local:FZMaterial>
                                <FZMaterial Width="76"
                                            Height="28"
                                            Color="{StaticResource H_Color_Primary_Black}"
                                            Preset="{StaticResource H_Roundtangle_BottomOnly_1px}"
                                            VerticalAlignment="Bottom"
                                            HorizontalAlignment="Center"
                                            DockPanel.Dock="Bottom">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DriveType}"
                                                       CapHeight="18"
                                                       TextWrapping="WrapWithOverflow"
                                                       Color="{StaticResource H_Color_Primary_White}"
                                                       FontFamily="Horizon_B"
                                                       Text="{Binding PowertrainID, Converter={StaticResource A_PowertrainConverter}, ConverterParameter=text, FallbackValue=???}" />
                                </FZMaterial>
                            </DockPanel>
                        </local:FZMaterial>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="Control"
           x:Key="A_Style_Control_DriveTypeDisplay">
        <Setter Property="Height" Value="42"/>
        <Setter Property="local:BindingProxy.A" Value="{Binding PowertrainID}"/>
        <Setter Property="local:BindingProxy.B" Value="DriveType"/>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_DriveTrainDisplay}"/>
        <Setter Property="VerticalAlignment" Value="Center" />
    </Style>

    <Style TargetType="Control"
           x:Key="A_Style_Control_FlyerDriveTypeDisplay"
           BasedOn="{StaticResource A_Style_Control_DriveTypeDisplay}">
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_FlyerDriveTrainDisplay}"/>
    </Style>

</ResourceDictionary>
