<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:local="clr-namespace:ForzaUI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" >

    <local:FZBooleanToVisibilityConverter x:Key="A_Converter_BoolToVis" InvertResult="false" />

    <Thickness x:Key="A_Thickness_Margin_PlayerBar">78,40,78,0</Thickness>
    <Thickness x:Key="A_Thickness_Margin_ButtonBar">72,0,72,58</Thickness>

    <Style x:Key="A_Style_FZTextBlock_PlayerBar" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
        <Setter Property="Color" Value="White" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontSize" Value="23"/>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PlayerBarBold" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="Color" Value="White" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontSize" Value="22"/>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PlayerBarBoldBlack" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_PlayerBarBold}">
        <Setter Property="Color" Value="#ff303030" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PlayerBar_CurrencyText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}">
        <Setter Property="Color" Value="{StaticResource A_Color_PlayerBar_Currency_Text}" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontSize" Value="22"/>
        <Setter Property="Margin" Value="12"/>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_PlayerBar_CurrencyValueText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_PlayerBarBold}">
        <Setter Property="Margin" Value="12"/>
    </Style>

    <System:Double x:Key="A_Double_Size_PlayerBar">40</System:Double>

    <Style x:Key="A_Style_FrameworkElement_PlayerBar_Container"
        TargetType="{x:Type FrameworkElement}">
        <Setter Property="MinWidth" Value="{StaticResource A_Double_Size_PlayerBar}" />
        <Setter Property="MinHeight" Value="{StaticResource A_Double_Size_PlayerBar}" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_PlayerBar_CurrencyContainer"
        TargetType="{x:Type local:FZMaterial}"
        BasedOn="{StaticResource A_Style_FrameworkElement_PlayerBar_Container}">
        <Setter Property="Color" Value="#ffffff" />
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterLeftOnly}" />
    </Style>

    <local:MappingConverter x:Key="A_Converter_CurrencyValueContainerBackgroundColor"
                            Default="{StaticResource A_Color_ButtonBar_Background}">
        <local:MappingConverterEntry Key="False" Value="{StaticResource A_Color_CurrencyValueContainer_Dark}" />
    </local:MappingConverter>

    <Style x:Key="A_Style_FZMaterial_PlayerBar_CurrencyValueContainer"
           TargetType="{x:Type local:FZMaterial}"
           BasedOn="{StaticResource A_Style_FrameworkElement_PlayerBar_Container}">
        <Setter Property="Color" Value="{Binding ShowPlayerAndCarInfo, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_Converter_CurrencyValueContainerBackgroundColor}}"/>
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterRightOnly}" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_PlayerBar_CarInfoBackground"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Color" Value="{StaticResource A_Color_ButtonBar_Background}"/>
        <Setter Property="MinWidth" Value="{StaticResource A_Double_Size_PlayerBar}" />
        <Setter Property="MinHeight" Value="{StaticResource A_Double_Size_PlayerBar}" />
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}" />
    </Style>

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangleStroke_PlayerBar_PlayerNameBackground"
                                       AlphaMode="Cutout"
                                       CornerRadius="6,6,6,6"/>

    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerNameBackground"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Margin" Value="2,2,3,2" />
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangleStroke_PlayerBar_PlayerNameBackground}" />
    </Style>

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_FlatPanel_PlayerLevelBase_Dynamic"
                                       BasedOn="{DynamicResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}" />

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier10"
                                       BasedOn="{DynamicResource A_FZMaterialPresetRoundtangle_FlatPanel_PlayerLevelBase_Dynamic}"
                                       GradientColorA="#961f0a"
                                       GradientColorB="#df7a45"
                                       GradientAngle="45"/>
    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier11"
                                       BasedOn="{DynamicResource A_FZMaterialPresetRoundtangle_FlatPanel_PlayerLevelBase_Dynamic}"
                                       GradientColorA="#949faf"
                                       GradientColorB="#fafafb"
                                       GradientAngle="45"/>
    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier12"
                                       BasedOn="{DynamicResource A_FZMaterialPresetRoundtangle_FlatPanel_PlayerLevelBase_Dynamic}"
                                       GradientColorA="#bf6c11"
                                       GradientColorB="#feff61"
                                       GradientAngle="45"/>

    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Default"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Preset" Value="{DynamicResource A_FZMaterialPresetRoundtangle_FlatPanel_PlayerLevelBase_Dynamic}" />
        <Setter Property="Color" Value="{Binding XP, Converter={StaticResource A_XPConverter}}" />
    </Style>
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier1" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier2" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier3" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier4" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier5" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier6" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier7" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier8" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier9" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerBackground_Default}" />
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier10"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier10}" />
        <Setter Property="Color" Value="#FFFFFF" />
    </Style>
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier11"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier11}" />
        <Setter Property="Color" Value="#FFFFFF" />
    </Style>
    <Style x:Key="A_Style_FZMaterial_PlayerBar_PlayerBackground_Tier12"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PlayerBar_PlayerBackground_Tier12}" />
        <Setter Property="Color" Value="#FFFFFF" />
    </Style>

    <local:XPConverter x:Key="A_XPConverter_PlayerBarStyle" ResourcePrefix="A_Style_FZMaterial_PlayerBar_PlayerBackground_" />

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PlayerBar_Gamerpic"
                                       CornerRadius="6,6,6,6" />

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PlayerBar_GamerpicBorder"
                                       AlphaMode="Cutout"
                                       CornerRadius="8,8,8,8" />

    <Style x:Key="A_Style_FZMaterial_PlayerBar_GamerpicBackground"
           TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PlayerBar_GamerpicBorder}" />
    </Style>

    <System:Double x:Key="A_Double_Size_PlayerBar_Padding">6</System:Double>

    <Thickness x:Key="A_Margin_PlayerBarText">12,2,12,0</Thickness>

    <Size x:Key="A_Size_PlayerBar_GamerPicSizeParams">40,40</Size>

    <ControlTemplate x:Key="A_ControlTemplate_PlayerBar" TargetType="{x:Type local:PlayerBarControl}">
        <DockPanel Height="{StaticResource A_Double_Size_PlayerBar}"
                   Margin="{StaticResource A_Thickness_Margin_PlayerBar}" 
                   DataContext="{Binding DataSource, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PlayerBarControl}}}" >

            <!-- -->
            <!--  Stack panel right side  -->
            <!-- -->
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" local:ZPanel.SortByDepth="True">
                <DockPanel Visibility="{Binding IsCreditsIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                    <local:FZMaterial DockPanel.Dock="Left"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyContainer}">
                        <local:FZTextBlock Text="{local:Loc UnitStrings.IDS_Units_Credits_Label}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyText}" />
                    </local:FZMaterial>
                    <local:FZMaterial DockPanel.Dock="Right"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyValueContainer}">
                        <local:FZTextBlock Text="{Binding Credits, ConverterParameter=money, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyValueText}" />
                    </local:FZMaterial>
                </DockPanel>

                <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}"
                        Visibility="{Binding IsCreditsIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                <DockPanel Visibility="{Binding AreTokensEnabled, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                    <local:FZMaterial DockPanel.Dock="Left"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyContainer}">
                        <local:FZTextBlock Text="{local:Loc UnitStrings.IDS_Units_Tokens_Label}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyText}" />
                    </local:FZMaterial>
                    <local:FZMaterial DockPanel.Dock="Right"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyValueContainer}">
                        <local:FZTextBlock Text="{Binding Tokens}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyValueText}" />
                    </local:FZMaterial>
                </DockPanel>

                <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}"
                        Visibility="{Binding AreTokensEnabled, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                <DockPanel Visibility="{Binding IsForzathonPointsIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                    <local:FZMaterial DockPanel.Dock="Left"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyContainer}">
                        <local:FZTextBlock Text="{local:Loc ForzaEvents.IDS_FP}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyText}" />
                    </local:FZMaterial>
                    <local:FZMaterial DockPanel.Dock="Right"
                                      Style="{StaticResource A_Style_FZMaterial_PlayerBar_CurrencyValueContainer}">
                        <local:FZTextBlock Text="{Binding ForzathonPoints}"
                                           Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyValueText}" />
                    </local:FZMaterial>
                </DockPanel>

                <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}"
                        Visibility="{Binding IsForzathonPointsIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                <Grid Visibility="{Binding IsBrickChallengesIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                    <Grid ClipToBounds="True">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.27*"/>
                            <ColumnDefinition Width="0.40*"/>
                            <ColumnDefinition Width="0.33*"/>
                        </Grid.ColumnDefinitions>
                        <local:FZMaterial Grid.Column="0" Margin="0,0,-0.5,0">
                            <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                    GradientColorA="{StaticResource A_Color_PlayerBar_Bricks_GradientA}"
                                    GradientColorB="{StaticResource A_Color_PlayerBar_Bricks_GradientB}"
                                    CornerRadius="{StaticResource A_CornerRadius_Outer_Left}"/>
                            </local:FZMaterial.Preset>
                        </local:FZMaterial>
                        <local:FZMaterial Grid.Column="1" Margin="-0.5,0">
                            <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                    GradientColorA="{StaticResource A_Color_PlayerBar_Bricks_GradientB}"
                                    GradientColorB="{StaticResource A_Color_PlayerBar_Bricks_GradientC}"/>
                            </local:FZMaterial.Preset>
                        </local:FZMaterial>
                        <local:FZMaterial Grid.Column="2" Margin="-0.5,0,0,0">
                            <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                    GradientColorA="{StaticResource A_Color_PlayerBar_Bricks_GradientC}"
                                    GradientColorB="{StaticResource A_Color_PlayerBar_Bricks_GradientD}"
                                    CornerRadius="{StaticResource A_CornerRadius_Outer_Right}"/>
                            </local:FZMaterial.Preset>
                        </local:FZMaterial>
                    </Grid>
                    <DockPanel>
                        <Decorator DockPanel.Dock="Left"
                            Style="{StaticResource A_Style_FrameworkElement_PlayerBar_Container}">
                            <local:FZMaterial Margin="2"
                                Color="{StaticResource A_Color_PlayerBar_Bricks_InnerContainer}">
                                <local:FZMaterial.Preset>
                                    <local:FZMaterialPresetRoundtangle CornerRadius="6"/>
                                </local:FZMaterial.Preset>
                                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/LaunchChunk/PDLC2/PlayerBar/Lego_Brick.png"
                                    Width="109"
                                    Height="82"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Margin="-30,-31,-28,-15"/>
                            </local:FZMaterial>
                        </Decorator>
                        <Decorator DockPanel.Dock="Right"
                            Style="{StaticResource A_Style_FrameworkElement_PlayerBar_Container}"
                            RenderTransformOrigin="0.5,0.5"
                            RenderTransform="{StaticResource A_Transform_Italic}">
                            <local:FZTextBlock local:MultiStringFormatter.Format="{local:Loc Expansions.IDS_BrickChallenges_PlayerBar_Format}"
                                local:MultiStringFormatter.Param0="{Binding CurrentBricks, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}"
                                local:MultiStringFormatter.Param1="{Binding TotalBricks, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}"
                                Text="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                Style="{StaticResource A_Style_FZTextBlock_PlayerBar_CurrencyValueText}"
                                Color="{StaticResource A_Color_PlayerBar_Bricks_Text}" />
                        </Decorator>
                    </DockPanel>
                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/LaunchChunk/PDLC2/PlayerBar/Player_Bar_Sheen.png"
                        Color="{StaticResource A_Color_PlayerBar_Bricks_Sheen}"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Bottom"
                        GreedyMeasure="True">
                        <local:FZMaterial.Preset>
                            <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetAdditive}"
                                CornerRadius="{StaticResource A_CornerRadius_Outer_BottomLeft}"/>
                        </local:FZMaterial.Preset>
                    </local:FZMaterial>
                </Grid>

                <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}"
                        Visibility="{Binding IsBrickChallengesIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
            </StackPanel>

            <!-- -->
            <!--  Stack panel left side  -->
            <!-- -->
            <StackPanel Orientation="Horizontal" local:ZPanel.SortByDepth="True" >
                <StackPanel Orientation="Horizontal"
                            local:ZPanel.SortByDepth="True"
                            Visibility="{Binding ShowPlayerAndCarInfo, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">

                    <Grid>
                        <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                                          Color="{StaticResource A_Color_ButtonBar_Background}"
                                          Margin="1" />
                        <local:FZMaterial CaptureSubgraph="True">
                            <local:FZMaterial x:Name="bg_pill" Style="{Binding XP, Converter={StaticResource A_XPConverter_PlayerBarStyle}}">
                                <StackPanel Orientation="Horizontal">
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PlayerBar_GamerpicBackground}"
                                                          Margin="2">
                                            <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_PlayerBar_Gamerpic}"
                                                              ImageSource="{Binding UserProfile, Converter={StaticResource A_GamerPicOrTeamProfileConverter}, ConverterParameter={StaticResource A_Size_PlayerBar_GamerPicSizeParams}}"
                                                              Width="40"
                                                              Height="36"
                                                              VerticalAlignment="Center" />
                                        </local:FZMaterial>

                                        <Decorator Width="29" Margin="6">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_PlayerLevelText_Base}"
                                                               Visibility="{Binding IsXPIntroduced, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                               HorizontalAlignment="Center"
                                                               TextAlignment="Center" />
                                        </Decorator>

                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PlayerBar_PlayerNameBackground}">
                                            <DockPanel>
                                                <StackPanel Style="{StaticResource A_Style_FrameworkElement_PrestigeLevelContainer}"
                                                            DockPanel.Dock="Left"
                                                            Margin="8,0,0,2">
                                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PrestigeIcon}" />
                                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_PrestigeLevel}" />
                                                </StackPanel>
                                                <StackPanel Orientation="Horizontal"
                                                            Margin="{StaticResource A_Margin_PlayerBarText}"
                                                            DockPanel.Dock="Right">
                                                    <local:FZTextBlock Text="{Binding UserProfile.FormattedClubTag}"
                                                                       Style="{StaticResource A_Style_FZTextBlock_PlayerBarBold}"
                                                                       Visibility="{Binding UserProfile.FormattedClubTag, Converter={StaticResource A_StringVisConverter}}"
                                                                       Margin="0,0,8,0" />
                                                    <local:FZTextBlock Text="{Binding UserProfile.FormattedGamertag}"
                                                                       Style="{StaticResource A_Style_FZTextBlock_PlayerBarBold}" />
                                                </StackPanel>
                                            </DockPanel>
                                        </local:FZMaterial>
                                </StackPanel>
                            </local:FZMaterial>
                        </local:FZMaterial>
                    </Grid>

                    <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}" />

                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PlayerBar_CarInfoBackground}">
                        <StackPanel Orientation="Horizontal" 
                                    VerticalAlignment="Center"
                                    Margin="12,3,0,3">
                            <local:FZTextBlock Text="{Binding MakeName}" 
                                               Style="{StaticResource A_Style_FZTextBlock_PlayerBarBold}" />
                            <local:FZTextBlock Text="{Binding CarName}" 
                                               Style="{StaticResource A_Style_FZTextBlock_PlayerBar}" 
                                               Margin="5, 0, 12, 0" />
                            <Decorator Width="{StaticResource A_Double_Size_PlayerBar_Padding}" />
                            <Control Style="{StaticResource A_Style_Control_CarClassBadge_Small_Leaderboard}"
                                     Height="34"
                                     local:BindingProxy.A="{Binding PerformanceIndex}"
                                     local:BindingProxy.B="{Binding ClassID}"
                                     HorizontalAlignment="Right" />
                            <Decorator Width="3" />
                        </StackPanel>
                    </local:FZMaterial>
                </StackPanel>
            </StackPanel>
        </DockPanel>
    </ControlTemplate>

    <Storyboard x:Key="ShowControllerButtonPanel">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
            <LinearDoubleKeyFrame KeyTime="0:0:0.100" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <Storyboard x:Key="ShowControllerButtonPanelInstant">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
            <LinearDoubleKeyFrame KeyTime="0" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

    <Storyboard x:Key="HideControllerButtonPanel">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
            <LinearDoubleKeyFrame KeyTime="0:0:0.100" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <Storyboard x:Key="HideControllerButtonPanelInstant">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)">
            <LinearDoubleKeyFrame KeyTime="0" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>

    <ControlTemplate x:Key="A_ControlTemplate_ButtonBar" TargetType="ContentControl">
        <Grid RenderTransformOrigin="0.5,1.0"
              VerticalAlignment="Bottom"
              Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Grid Margin="{StaticResource A_Thickness_Margin_ButtonBar}"
                  VerticalAlignment="Bottom"
                  HorizontalAlignment="Left">
                <local:FZMaterial x:Name="ControllerStyleBackground"
                                  Style="{StaticResource A_Style_ControllerButton_Background}"
                                  Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_ConsoleButtonBarBackground_All}">
                    <ContentPresenter x:Name="ControllerButtonPanel"
                                      Margin="4,0,0,0"
                                      VerticalAlignment="Center" />
                </local:FZMaterial>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding IsControllerActiveInput, RelativeSource={RelativeSource AncestorType=Page}}"
                         Value="False">
                <Setter TargetName="ControllerStyleBackground"
                        Property="Color"
                        Value="#00000000" />
                <Setter TargetName="ControllerButtonPanel"
                        Property="Margin"
                        Value="0" />
            </DataTrigger>
            <DataTrigger Binding="{Binding ActualWidth, ElementName=ControllerButtonPanel}"
                         Value="0">
                <Setter TargetName="ControllerButtonPanel"
                        Property="Margin"
                        Value="0" />
            </DataTrigger>
            <EventTrigger RoutedEvent="ControllerButtonPanel.ShowControllerButtonPanel">
                <local:BeginUIStoryboard Storyboard="{StaticResource ShowControllerButtonPanel}"/>
            </EventTrigger>
            <EventTrigger RoutedEvent="ControllerButtonPanel.ShowControllerButtonPanelInstant">
                <local:BeginUIStoryboard Storyboard="{StaticResource ShowControllerButtonPanelInstant}"/>
            </EventTrigger>
            <EventTrigger RoutedEvent="ControllerButtonPanel.HideControllerButtonPanel">
                <local:BeginUIStoryboard Storyboard="{StaticResource HideControllerButtonPanel}"/>
            </EventTrigger>
            <EventTrigger RoutedEvent="ControllerButtonPanel.HideControllerButtonPanelInstant">
                <local:BeginUIStoryboard Storyboard="{StaticResource HideControllerButtonPanelInstant}"/>
            </EventTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="A_Style_PlayerBarControl"
           BasedOn="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
           TargetType="{x:Type local:PlayerBarControl}">
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_PlayerBar}" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="RenderTransformOrigin"
                Value="0.5,0.0" />
        <Setter Property="Height"
                Value="auto" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsE3, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="True">
                <Setter Property="Visibility" Value="Collapsed" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsIE, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="True">
                <Setter Property="Visibility" Value="Collapsed" />
            </DataTrigger>
            <DataTrigger Binding="{Binding InSplash, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="True">
                <Setter Property="Visibility" Value="Collapsed" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_PlayerBarControl_WithTokens" TargetType="local:PlayerBarControl" BasedOn="{StaticResource A_Style_PlayerBarControl}">
        <Setter Property="ShowTokens" Value="True" />
    </Style>

    <Style x:Key="A_Style_ButtonBar" TargetType="ContentControl">
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_ButtonBar}" />
        <Setter Property="Focusable" Value="False" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_E3ButtonBar" TargetType="ContentControl">
        <Grid RenderTransformOrigin="0.5,1.0"
              VerticalAlignment="Bottom"
              Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <ContentPresenter Margin="{StaticResource A_Thickness_Margin_ButtonBar}" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_E3ButtonBar" TargetType="ContentControl">
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_E3ButtonBar}" />
    </Style>

</ResourceDictionary>