<Page xmlns:local="clr-namespace:ForzaUI;assembly="
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.A_SelectUpgradePart"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <local:NumUnitConverter x:Key="A_NumUnitConverter_Units"
                                    FractionDigits="0" />

            <Thickness x:Key="A_Margin_PeformanceStats_Margin">22,12</Thickness>
            <GridLength x:Key="A_GridLength_PeformanceStats_RowHeight">34</GridLength>
            <GridLength x:Key="A_GridLength_PeformanceStats_ColumnSpacing">24</GridLength>

            <Style x:Key="DynoGraphHorzLineStyle"
                   TargetType="{x:Type Path}">
                <Setter Property="Data"
                        Value="M0,0 L310,0" />
                <Setter Property="Stroke"
                        Value="White" />
                <Setter Property="StrokeThickness"
                        Value="1" />
                <Setter Property="StrokeEndLineCap"
                        Value="Square" />
                <Setter Property="VerticalAlignment"
                        Value="Bottom" />
                <Setter Property="HorizontalAlignment"
                        Value="Stretch" />
                <Setter Property="Opacity"
                        Value="0.8" />
            </Style>

            <Style x:Key="DynoGraphVertLineStyle"
                   TargetType="{x:Type Path}">
                <Setter Property="Data"
                        Value="M0,0 L0,-210" />
                <Setter Property="Stroke"
                        Value="White" />
                <Setter Property="StrokeThickness"
                        Value="1" />
                <Setter Property="StrokeEndLineCap"
                        Value="Square" />
                <Setter Property="VerticalAlignment"
                        Value="Bottom" />
                <Setter Property="HorizontalAlignment"
                        Value="Right" />
                <Setter Property="Opacity"
                        Value="0.8" />
            </Style>
         
            <Style x:Key="A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider"
                    BasedOn="{StaticResource A_Style_FZMaterial_GlassPanel_HorizontalDivider}"
                    TargetType="{x:Type local:FZMaterial}">
                <Setter Property="Margin"
                        Value="0,0,0,0" />
            </Style>

            <Style x:Key="A_Style_SidePanel_SelectUpgradePart_HideCostIfOwned"
                    TargetType="ContentControl">
                <Setter Property="Template"
                        Value="{StaticResource A_ControlTemplate_SidePanel_UpgradeCost}" />
                <Setter Property="local:BindingProxy.A"
                        Value="{Binding SelectedPartName}" />
                <Setter Property="HorizontalAlignment"
                        Value="Left" />
                <Setter Property="Width"
                        Value="{StaticResource H_Width_Upgrades}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.Status, ElementName=PART_ItemList}"
                                 Value="0">
                        <Setter Property="local:BindingProxy.B"
                                Value="{Binding SelectedItem.PriceCredits, Converter={StaticResource A_NumUnitConverter_Units}, ElementName=PART_ItemList}" />
                        <Setter Property="local:BindingProxy.C"
                                Value="{Binding SelectedItem.PriceTokens, Converter={StaticResource A_NumUnitConverter_Units}, ElementName=PART_ItemList}" />
                        <Setter Property="BindingProxy.AlwaysValidNumeric"
                                Value="{Binding SelectedItem.TotalDiscount, ElementName=PART_ItemList}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding AreTokensEnabled, Source={StaticResource PART_UISceneContext}}"
                                 Value="false">
                        <Setter Property="local:BindingProxy.C"
                                Value="" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_RowDefinition_SeparatorRow"
                   TargetType="RowDefinition">
                <Setter Property="Height"
                        Value="Auto" />
            </Style>

            <Style x:Key="A_Style_TextBlock_GraphLegendText_SelectUpgradePart"
                    TargetType="local:FZTextBlock"
                    BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Minimum}">
                <Setter Property="HorizontalAlignment"
                        Value="Center" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
                <Setter Property="CapHeight"
                        Value="14" />
                <Setter Property="Margin"
                        Value="0,8" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_StatLabel_With_AutoScroll" TargetType="FZTextBlock"
                BasedOn="{StaticResource A_Style_FZTextBlock_StatLabel}">
                <Setter Property="Stretch" Value="None"/>
                <Setter Property="AutoScroll" Value="{StaticResource H_AutoScrollSettings_Horizontal_Title}"/>
                <Setter Property="AutoScroll.AllowScrolling" Value="True"/>
            </Style>

            <Style x:Key="A_Style_TextBlock_BenchmarkStatValue_UpgradePart"
                   TargetType="{x:Type local:FZTextBlock}"
                   BasedOn="{StaticResource A_Style_TextBlock_BenchmarkStatValue}">
                <Setter Property="MaxWidth"
                        Value="92" />
            </Style>

            <Style x:Key="A_Style_FZMaterial_StatLabel_Change_Arrow" TargetType="FZMaterial"
                BasedOn="{StaticResource A_Style_FZMaterial_Change_Arrow}">
                <Setter Property="Width" Value="12"/>
                <Setter Property="Height" Value="8"/>
            </Style>

            <Style x:Key="A_Style_SelectUpgradePart_GridPerformanceRow" 
                   TargetType="Control" >
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <DockPanel>
                                <StackPanel Orientation="Horizontal"
                                            HorizontalAlignment="Right"
                                            DockPanel.Dock="Right">
                                    <FZMaterial Style="{StaticResource A_Style_FZMaterial_StatLabel_Change_Arrow}"
                                                Width="12"
                                                Height="8"
                                                Tag="{DynamicDataBinding StatChange}" 
                                                Color="{DynamicDataBinding StatChange, Converter={StaticResource A_Converter_ChangeToColor}}"
                                                Visibility="{DynamicDataBinding StatChange, Converter={StaticResource A_Converter_Arrow_ChangeToVisibility}}" />
                                    <Decorator Width="6"/>
                                    <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_StatInfo}" 
                                                 TextAlignment="Right"
                                                 Margin="0,0,0,0"
                                                 Color="{DynamicDataBinding StatChange, Converter={StaticResource A_Converter_ChangeToColor}}"
                                                 Text="{DynamicDataBinding UpgradedStat}" />
                                </StackPanel>
                                <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_StatLabel_With_AutoScroll}"
                                             MaxWidth="infinity"
                                             Text="{DynamicDataBinding CarStatLabel}"
                                             Color="{StaticResource H_Color_Primary_White}"
                                             DockPanel.Dock="Left"
                                             Margin="0,0,6,0"/>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_BenchmarkHeader" TargetType="FZTextBlock"
                BasedOn="{StaticResource A_Style_TextBlock_BenchmarkSectionHeader}">
                <Setter Property="CapHeight" Value="16"/>
            </Style>

            <ControlTemplate x:Key="A_Template_Control_SelectUpgradePart_Benchmark" TargetType="Control">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                    </Grid.RowDefinitions>

                    <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BenchmarkHeader}"
                                 Grid.Row="0"
                                 Text="{local:Loc Benchmark.IDS_BRAKING_DISTANCE}" />

                    <FZMaterial Grid.Row="1" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />
                    
                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="2">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding Brake60Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding Brake60Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="3" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="4">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding Brake100Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding Brake100Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="5" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BenchmarkHeader}"
                                        Grid.Row="6"
                                        Text="{local:Loc Benchmark.IDS_LATERAL_Gs}" />

                    <local:FZMaterial Grid.Row="7" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="8">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding LatG60Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding LatG60Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="9" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="10">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding LatG120Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding LatG120Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>
                </Grid>
            </ControlTemplate>

            <ControlTemplate x:Key="A_Template_Control_AccelerationSpeed" TargetType="Control">
                <Grid Grid.Column="5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                    </Grid.RowDefinitions>

                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BenchmarkHeader}"
                                        Grid.Row="0"
                                        Text="{local:Loc Benchmark.IDS_ACCELERATION_SPEED}" />

                    <local:FZMaterial Grid.Row="1" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="2">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding Accel60Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding Accel60Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="3" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="4">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{Binding Accel100Label}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding Accel100Stat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="5" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="6">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{local:Loc Benchmark.IDS_TopSpeed}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding TopSpeedStat}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="7" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />
                </Grid>
            </ControlTemplate>

            <ControlTemplate x:Key="A_Template_Control_SelectUpgradePart_Benchmark_Aero" TargetType="Control">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                        <RowDefinition Height="*" />
                        <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                    </Grid.RowDefinitions>

                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BenchmarkHeader}"
                                        Grid.Row="0"
                                        Text="{local:Loc Benchmark.IDS_Aero}" />

                    <local:FZMaterial Grid.Row="1" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="2">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{local:Loc Benchmark.IDS_Efficiency}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding AeroEfficiency}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="3" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="4">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{local:Loc Benchmark.IDS_Balance}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding AeroBalance}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="5" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_BenchmarkHeader}"
                                        Grid.Row="6"
                                        Text="{local:Loc Benchmark.IDS_Chassis}" />

                    <local:FZMaterial Grid.Row="7" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />

                    <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="8">
                        <DynamicData.Data>
                            <DynamicDataSource>
                                <DynamicDataItem Name="CarStatLabel"
                                                 DataType="String"
                                                 Value="{local:Loc Benchmark.IDS_RoadBalance}" />
                                <DynamicDataItem Name="StatChange"
                                                 DataType="Int32"
                                                 Value="0" />
                                <DynamicDataItem Name="UpgradedStat"
                                                 DataType="String"
                                                 Value="{Binding RoadBalance}"/>
                            </DynamicDataSource>
                        </DynamicData.Data>
                    </Control>

                    <local:FZMaterial Grid.Row="9" Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" />
                </Grid>
            </ControlTemplate>

            <ControlTemplate x:Key="A_ControlTemplate_SidePanel_SelectUpgradePart" TargetType="ContentControl">
                <DockPanel>
                    <ContentControl DockPanel.Dock="Top" 
                                    HorizontalContentAlignment="Left" 
                                    Style="{StaticResource A_Style_ContentControl_Header_Custom}">
                        <FZTextBlock Style="{StaticResource H_Style_Text_DescriptionTitle}"
                                     FontFamily="Horizon_A"
                                     Text="{TemplateBinding Tag}"/>
                    </ContentControl>
                    <ContentControl DockPanel.Dock="Top" 
                                    Content="{TemplateBinding Content}" 
                                    Template="{DynamicResource A_ControlTemplate_SidePanelContent}" />
                </DockPanel>
            </ControlTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="PART_LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="PART_VisualState_PerformanceBars" />
                <VisualState x:Name="PART_VisualState_PerformanceStats">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceRatings">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceStats">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Visible}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="PART_VisualState_Benchmark">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceRatings">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_MainPartInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_BenchmarkInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Visible}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_AccelerationInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_BenchmarkInfo_Aero">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:FZMaterial.Preset)"
                                                       Storyboard.TargetName="StatsPanel">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterBottomOnly}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="PART_VisualState_AccelerationSpeed">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceRatings">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_MainPartInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_BenchmarkInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_AccelerationInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Visible}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_BenchmarkInfo_Aero">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:FZMaterial.Preset)"
                                                       Storyboard.TargetName="StatsPanel">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterBottomOnly}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="PART_VisualState_Benchmark_Aero">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                       Storyboard.TargetName="Grid_PerformanceRatings">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                       Storyboard.TargetName="Grid_MainPartInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                       Storyboard.TargetName="Panel_BenchmarkInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                       Storyboard.TargetName="Panel_AccelerationInfo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Panel_BenchmarkInfo_Aero">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Visible}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:FZMaterial.Preset)"
                                                       Storyboard.TargetName="StatsPanel">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterBottomOnly}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup  x:Name="VisualStateGroup_UpgradeType">
                <VisualState x:Name="PART_VisualState_Wheels">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_AftermarketLogo">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Visible}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <local:RoutedEventCommand x:Name="ToggleStatsRoutedEventCommand"
                            RoutedEvent="UIElement.MouseLeftButtonDown"
                            Command="{Binding ToggleStatsCommand, RelativeSource={RelativeSource AncestorType=Page}}" />

        <!-- Bars -->
        <local:PlayerBarControl x:Name="TopBar"
                        Style="{StaticResource A_Style_PlayerBarControl_WithTokens}"
                        ShowPlayerAndCarInfo="{Binding SeamlessUpgrades, Converter={StaticResource A_Converter_Boolean_Invert}, RelativeSource={RelativeSource AncestorType=Page}}"/>

        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                    x:Name="BottomBar">
            <local:ControllerButtonPanel x:Name="PART_HelpPanel"
                                         Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="A" />
                <local:ControllerButtonControl Button="B" />
                <local:ControllerButtonControl Button="X" />
                <local:ControllerButtonControl Button="Y" />
                <local:ControllerButtonControl Button="Start" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                        VerticalAlignment="Center"
                        Margin="96,0"
                        Height="850">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <ContentControl x:Name="Screen_Title"
                        Style="{StaticResource H_Style_TemplatedWrapper_ScreenTitle}"
                        Content="{Binding TypeName}"
                        HorizontalAlignment="Left"
                        Width="{StaticResource H_Width_Upgrades}"
                        Grid.Row="0" />

                <ContentControl x:Name="Description"
                        Style="{StaticResource A_Style_SidePanel_SelectUpgradePart_HideCostIfOwned}"
                        Grid.Row="2">
                    <Grid x:Name="StatsPanel">
                        <Grid x:Name="Grid_MainPartInfo"
                              Margin="{StaticResource A_Margin_PeformanceStats_Margin}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="26"/> <!-- This is the space between the colums -->
                                <ColumnDefinition Width="116"/>
                            </Grid.ColumnDefinitions>

                            <StackPanel x:Name="DriveTrainAndPI"
                                        Grid.Column="2"
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Right"
                                        Orientation="Vertical">
                                <DockPanel HorizontalAlignment="Right">
                                    <Control Style="{StaticResource H_Style_TemplatedElement_CarClassBadge}"
                                            local:BindingProxy.A="{Binding Stats.Upgraded.PerformanceIndex}"
                                            local:BindingProxy.B="{Binding Stats.Upgraded.ClassID}"
                                            DockPanel.Dock="Right"
                                            HorizontalAlignment="Right"
                                            Margin="7,0,0,0"
                                            Height="35"/>
                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_StatLabel_Change_Arrow}"
                                            Tag="{Binding Stats.PerformanceIndexChange}" 
                                            Color="{Binding Stats.PerformanceIndexChange, Converter={StaticResource A_Converter_ChangeToColor}}"
                                            Visibility="{Binding Stats.PerformanceIndexChange, Converter={StaticResource A_Converter_Arrow_ChangeToVisibility}}" 
                                            DockPanel.Dock="Right"
                                            HorizontalAlignment="Right"
                                            Height="8"
                                            Width="12"/>
                                </DockPanel>
                                <Decorator Height="10"/>
                                <Control Style="{StaticResource A_Style_Control_DriveTrainDisplay}"
                                        DataContext="{Binding Stats.Upgraded}"
                                        HorizontalAlignment="Left" 
                                        Height="35"/>
                            </StackPanel>

                            <Grid x:Name="Grid_PerformanceRatings"
                                    DataContext="{Binding Stats}"
                                    Grid.Column="0">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                </Grid.RowDefinitions>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="0">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Speed}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding SpeedRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.SpeedRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="1"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="2">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Handling}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding HandlingRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.HandlingRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="3"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="4">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Accel}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding AccelerationRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.AccelerationRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="5"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="6">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Launch}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding LaunchRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.LaunchRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="7"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="8">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Braking}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding BrakingRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.BrakingRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="9"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="10">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Offroad}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding OffroadRatingChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.OffroadRating, Converter={StaticResource A_NumUnitConverter_NoUnit_1dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>
                            </Grid>

                            <Grid x:Name="Grid_PerformanceStats"
                                    DataContext="{Binding Stats}"
                                    Visibility="Collapsed"
                                    Grid.Column="0">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Style="{StaticResource A_Style_RowDefinition_SeparatorRow}" />
                                    <RowDefinition Height="*"/>

                                </Grid.RowDefinitions>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="0">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Power}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding SimPeakPowerChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.SimPeakPower, ConverterParameter=power, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="1" />

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="2" >
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Torque}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding SimPeakTorqueChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.SimPeakTorque,  ConverterParameter=torque, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="3" />

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="4" >
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Weight}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding CurbWeightChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.CurbWeight, ConverterParameter=mass, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="5" />

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="6" >
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Front}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding WeightDistributionChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.WeightDistribution, ConverterParameter=fracpercentage, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="7" />

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="8" >
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_PowerToWeight}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding PowerToWeightChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.PowerToWeight, ConverterParameter=PowerToWeight, Converter={StaticResource A_NumUnitConverter_ShowUnit_2dp_InsertMarkup}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>

                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_SelectUpgradePart_HorizontalDivider}" Grid.Row="9"
                                                  Visibility="{Binding Current.EngineConfigID, Converter={StaticResource A_MappingConverter_HideWhenElectricEngine}}"/>

                                <Control Style="{StaticResource A_Style_SelectUpgradePart_GridPerformanceRow}" Grid.Row="10"
                                         Visibility="{Binding Current.EngineConfigID, Converter={StaticResource A_MappingConverter_HideWhenElectricEngine}}">
                                    <DynamicData.Data>
                                        <DynamicDataSource>
                                            <DynamicDataItem Name="CarStatLabel"
                                                        DataType="String"
                                                        Value="{Loc CarFlow.IDS_Stat_Displacement}" />
                                            <DynamicDataItem Name="StatChange"
                                                        DataType="Int32"
                                                        Value="{Binding DisplacementChange}" />
                                            <DynamicDataItem Name="UpgradedStat"
                                                        DataType="String"
                                                        Value="{Binding Upgraded.Displacement, Converter={StaticResource A_NumUnitConverter_ShowUnit_0dp}}"/>
                                        </DynamicDataSource>
                                    </DynamicData.Data>
                                </Control>
                            </Grid>
                        </Grid>

                        <Control x:Name="Panel_BenchmarkInfo"
                                 Visibility="Collapsed"
                                 Margin="{StaticResource A_Margin_PeformanceStats_Margin}"
                                 Template="{StaticResource A_Template_Control_SelectUpgradePart_Benchmark}"
                                 DataContext="{Binding Benchmark}"/>
                        <Control x:Name="Panel_AccelerationInfo"
                                 Visibility="Collapsed"
                                 Margin="{StaticResource A_Margin_PeformanceStats_Margin}"
                                 Template="{StaticResource A_Template_Control_AccelerationSpeed}"
                                 DataContext="{Binding Benchmark}"/>
                        <Control x:Name="Panel_BenchmarkInfo_Aero"
                                 Visibility="Collapsed"
                                 Margin="{StaticResource A_Margin_PeformanceStats_Margin}"
                                 Template="{StaticResource A_Template_Control_SelectUpgradePart_Benchmark_Aero}"
                                 DataContext="{Binding Benchmark}"/>
                    </Grid>
                </ContentControl>


                <Grid x:Name="Grid_AftermarketLogo"
                        Grid.Row="2"
                        Grid.Column="2"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Top"
                        Width="148"
                        Height="148"
                        Visibility="Collapsed">
                    <local:FZMaterial Preset="{StaticResource H_Roundtangle_Outer_1px}" Color="{StaticResource H_Color_Primary_White}" />
                    <local:FZMaterial ImageSource="{Binding SelectedItem.LogoPath, ElementName=PART_ItemList}" />
                </Grid>

                <!--Using decorator as visibility converter does not work for this ContentControl-->
                <Decorator x:Name="Performance_Graph"
                            Grid.Row="2"
                            Grid.Column="2"
                            Grid.RowSpan="2"
                            Visibility="{Binding IsPerformanceGraphVisible, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                    <ContentControl Template="{StaticResource A_ControlTemplate_SidePanel_SelectUpgradePart}"
                            DataContext="{Binding SelectedItem, ElementName=PART_ItemList}"
                            Tag="{local:Loc UpgradeCar.IDS_Performance}"
                            HorizontalAlignment="Left"
                            Width="{StaticResource H_Width_Upgrades}">
                        <Grid x:Name="Grid_Dyno">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="16" />
                                <ColumnDefinition Width="52" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="90" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="16" />
                                <RowDefinition Height="*" />
                                <RowDefinition Height="48" />
                            </Grid.RowDefinitions>

                            <UniformGrid x:Name="UniformGrid_RowsY"
                                         Grid.Row="1"
                                         Grid.Column="2"
                                         Rows="8"
                                         ClipToBounds="True">
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                                <Path Style="{StaticResource DynoGraphHorzLineStyle}" />
                            </UniformGrid>
                            <UniformGrid x:Name="UniformGrid_ColumnsX"
                                         Grid.Row="1"
                                         Grid.Column="2"
                                         Columns="10"
                                         ClipToBounds="True">
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                                <Path Style="{StaticResource DynoGraphVertLineStyle}" />
                            </UniformGrid>
                            <FZTextBlock Grid.Row="1"
                                         Grid.Column="1"
                                         Text="{Binding TextMaxPower, ElementName=PART_XYGraph, FallbackValue=5000}"
                                         Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                         VerticalAlignment="Top"
                                         HorizontalAlignment="Right"
                                         Margin="0, 0, 8, 0" />
                            <FZTextBlock Grid.Row="1"
                                         Grid.Column="1"
                                         Text="{Binding TextMidPower, ElementName=PART_XYGraph, FallbackValue=2500}"
                                         Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                         VerticalAlignment="Center"
                                         HorizontalAlignment="Right"
                                         Margin="0, 0, 8, 0" />
                            <FZTextBlock Grid.Row="2"
                                         Grid.Column="1"
                                         Text="0"
                                         Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                         VerticalAlignment="Top"
                                         HorizontalAlignment="Right"
                                         Margin="0, 8, 8, 0" />

                            <!-- Footer-->
                            <Grid Grid.Row="2"
                                Grid.Column="2"
                                VerticalAlignment="Top"
                                Margin="0,8,0,0">
                                <local:FZTextBlock Text="{local:Loc UpgradeCar.IDS_RPM}"
                                        Style="{StaticResource A_Style_FZTextBlock_StatLabel}"
                                        VerticalAlignment="Top"
                                        Margin="8,0,0,0" />

                                <local:FZTextBlock Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                        Text="{Binding TextMidRPM, ElementName=PART_XYGraph, FallbackValue=5}"
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Center"
                                        TextAlignment="Center" />

                                <local:FZTextBlock Style="{StaticResource A_Style_TextBlock_GraphLegendText}"
                                        Text="{Binding TextMaxRPM, ElementName=PART_XYGraph, FallbackValue=10}"
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Right" />
                            </Grid>

                            <local:FZMaterial Grid.Row="1"
                                            Grid.Column="1"
                                            Color="White"
                                            Width="2"
                                            HorizontalAlignment="Right" />
                            <local:FZMaterial Grid.Row="1"
                                            Grid.Column="2"
                                            Color="White"
                                            Height="2"
                                            VerticalAlignment="Bottom" />

                            <local:XYGraphRenderer x:Name="PART_XYGraph"
                                                Grid.Column="2"
                                                Grid.Row="1"
                                                ClipToBounds="True"
                                                MapProfile="upgradegraph_akz"
                                                MapId="upgradegraph" />

                            <StackPanel Grid.Row="1"
                                    Grid.Column="3"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Bottom"
                                    Width="140"
                                    Margin="0,0,-60,0">

                                <local:FZMaterial MinWidth="32"
                                                Height="32"
                                                Preset="{Roundtangle CornerRadius={StaticResource H_CornerRadius_All_1px}}"
                                                Color="{StaticResource H_Color_Primary_Pink}"
                                                Margin="2">
                                    <local:FZTextBlock Text="{Binding TorqueLabel, ElementName=PART_XYGraph, FallbackValue=Torque}"
                                                    Style="{StaticResource A_Style_TextBlock_GraphLegendText_SelectUpgradePart}" 
                                                    Color="{StaticResource H_Color_Primary_White}" />
                                </local:FZMaterial>

                                <local:FZMaterial MinWidth="32"
                                                Height="32"
                                                Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"
                                                Color="{StaticResource H_Color_Primary_Yellow}"
                                                Margin="2">
                                    <local:FZTextBlock Text="{Binding PowerLabel, ElementName=PART_XYGraph, FallbackValue=Power}"
                                                    Style="{StaticResource A_Style_TextBlock_GraphLegendText_SelectUpgradePart}"
                                                    Color="{StaticResource H_Color_Primary_Black}"/>
                                </local:FZMaterial>

                            </StackPanel>
                        </Grid>
                    </ContentControl>
                </Decorator>

                <Control x:Name="Basket"
                        Style="{StaticResource H_Style_TemplatedElement_Basket}"
                        HorizontalAlignment="Left"
                        Width="{StaticResource H_Width_Upgrades}"
                        Grid.Row="3" />

                <DockPanel Grid.Row="1"
                        Margin="0,0,0,4"
                        HorizontalAlignment="Left">
                    <ScrollBar Style="{StaticResource H_Style_ScrollBar}"
                            Margin="8,0,0,0"
                            Minimum="{Binding ScrollWindowMin, ElementName=PART_ItemList}"
                            Maximum="{Binding ScrollWindowMax, ElementName=PART_ItemList}"
                            Value="{Binding ScrollWindowValue, ElementName=PART_ItemList, Mode=TwoWay}"
                            ViewportSize="{Binding ScrollWindowSize, ElementName=PART_ItemList}"
                            DockPanel.Dock="Right">
                        <DynamicData.Data>
                            <DynamicDataItem Name="ScrollBarHideWhenNotNeeded"
                                DataType="Boolean"
                                Value="True" />
                        </DynamicData.Data>
                    </ScrollBar>
                    <WrapListBox x:Name="PART_ItemList"
                            Style="{StaticResource H_Style_UpgradeGrid_Square_3x3}"
                            ScrollOrientation="Vertical"
                            ItemsSource="{Binding Collection}"
                            SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                            RoutedEventCommand.Action="{Binding ElementName=ButtonBarDisableMouseCursorMovement}"
                            RoutedEventCommand.Action2="{Binding ElementName=ButtonBarEnableMouseCursorMovement}" />
                </DockPanel>

                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_NonInteractive}"
                                  Grid.Row="1"
                                  Grid.Column="2"
                                  Height="72"
                                  Width="365"
                                  HorizontalAlignment="Left"
                                  Color="{StaticResource H_Color_Primary_Yellow}"
                                  VerticalAlignment="Top"
                                  Margin="0,0,0,4"
                                  Visibility="{Binding TuningInformation, Converter={StaticResource A_StringVisConverter}}">
                    <DockPanel Margin="22,0">
                        <local:FZMaterial DockPanel.Dock="Left"
                                          ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Unlock.png" 
                                          Color="{StaticResource H_Color_Primary_Black}"
                                          Width="30"
                                          Height="38"/>
                        <local:FZTextBlock Text="{Binding TuningInformation}"
                                           FontFamily="Horizon_C"
                                           CapHeight="12"
                                           Color="{StaticResource H_Color_Primary_Black}"
                                           Margin="21,10,0,10"
                                           LineAdjust="-0.5"
                                           VerticalAlignment="Center"
                                           TextWrapping="Wrap" />
                    </DockPanel>
                </local:FZMaterial>
            </Grid>

            <ContentControl Template="{StaticResource A_Template_Control_HudInstruction}" 
                            Content="{Binding SeamlessChallengeObjectiveString}" 
                            Visibility="{Binding SeamlessChallengeObjectiveString, Converter={StaticResource A_StringVisConverter}}"
                            Margin="96,52,0,0" 
                            HorizontalAlignment="Left"/>
            <ContentControl Template="{StaticResource A_ControlTemplate_StoryChallenges}" />
            <ContentControl Template="{StaticResource A_ControlTemplate_StoryChallenges}" />
        </Grid>
    </Grid>
</Page>
