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

            <Style x:Key="A_Style_FrameworkElement_Cost"
                   TargetType="FrameworkElement">
                <Setter Property="HorizontalAlignment"
                        Value="Center" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
            </Style>

            <Style x:Key="A_Style_FrameworkElement_ShowIfOwnedNotInstalled"
                   TargetType="FrameworkElement"
                   BasedOn="{StaticResource A_Style_FrameworkElement_Cost}">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.Status, ElementName=PART_ItemList}"
                                 Value="2">
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SelectedItem.InBasket, ElementName=PART_ItemList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FrameworkElement_ShowIfInstalled"
                   TargetType="FrameworkElement"
                   BasedOn="{StaticResource A_Style_FrameworkElement_Cost}">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.Status, ElementName=PART_ItemList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SelectedItem.InBasket, ElementName=PART_ItemList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FrameworkElement_ShowIfNotOwned"
                   TargetType="FrameworkElement">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.Status, ElementName=PART_ItemList}"
                                 Value="0">
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding SelectedItem.InBasket, ElementName=PART_ItemList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FrameworkElement_ShowIfInBasket"
                   TargetType="FrameworkElement">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.InBasket, ElementName=PART_ItemList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="DynoGraphHorzLineStyle"
                   TargetType="{x:Type Path}">
                <Setter Property="Data"
                        Value="M0,0 L20000,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,-458" />
                <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="StrokeDashArray"
                        Value="7.4 7.4" />
                <Setter Property="StrokeDashOffset"
                        Value="3" />
                <Setter Property="Opacity"
                        Value="0.8" />
            </Style>

            <Style x:Key="A_Style_FZTextBlock_CarCost"
                   TargetType="local:FZTextBlock">
                <Setter Property="CapHeight"
                        Value="24" />
                <Setter Property="FontFamily"
                        Value="Horizon_A" />
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Footer_Text}" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="VisualState_PerformanceBars" />
                <VisualState x:Name="VisualState_PerformanceStats">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceBars">
                            <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="VisualState_Benchmark">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="Grid_PerformanceBars">
                            <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="(local:FZMaterial.Preset)"
                                                       Storyboard.TargetName="StatsPanel">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterBottomOnly}" />
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="CostPanel">
                            <DiscreteObjectKeyFrame KeyTime="0"
                                                    Value="{x:Static Visibility.Collapsed}" />
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup  x:Name="VisualStateGroup_UpgradeType">
                <VisualState x:Name="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>

        <Grid>
            <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}" />

            <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
                <local:ControllerButtonPanel x:Name="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:ControllerButtonControl Button="DPadVertical"
                                                   InputOverride="{local:Input Command=INPUTCMD_UI_DPAD_UP_PRESS, Context=INPUTCONTEXT_UI}"
                                                   local:RoutedEventCommand.Action="{Binding ElementName=ToggleStatsRoutedEventCommand}" />
                </local:ControllerButtonPanel>
            </ContentControl>

            <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
                <Grid Width="{StaticResource A_Double_Carousel_Square_10Item_Total_Width}">
                    <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}" 
                               LastChildFill="True">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        Content="{Binding TypeName, Converter={StaticResource A_StringToUpper}}" 
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Upgrades.png" 
                                        MaxWidth="1200" HorizontalAlignment="Left" DockPanel.Dock="Top" 
                                        Margin="0,0,0,12"/>

                        <ContentControl Template="{StaticResource A_Template_ContentControl_SelectorContainer_PageButtons}"
                                        DockPanel.Dock="Bottom"
                                        Margin="0,12,0,-20"
                                        Panel.ZIndex="1">
                            <local:WrapListBox x:Name="PART_ItemList"
                                               Style="{StaticResource A_Style_Carousel_Square_10Item}"
                                               ItemsSource="{Binding Collection}"
                                               SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
                        </ContentControl>


                        <DockPanel LastChildFill="True">
                            <DockPanel DockPanel.Dock="Left" Width="360"
                                       Margin="0,0,12,0">
                                <ContentControl Content="{Binding SelectedPartName, Converter={StaticResource A_StringToUpper}}"
                                                Style="{StaticResource A_Style_ContentControl_Header}" 
                                                DockPanel.Dock="Top" />
                                <Grid x:Name="CostPanel" DockPanel.Dock="Bottom" Height="74">
                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_FooterPanel}" />
                                    <Grid HorizontalAlignment="Center">
                                        <Grid x:Name="InstalledTextBlock"
                                              Style="{StaticResource A_Style_FrameworkElement_ShowIfInstalled}">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarCost}"
                                                               Text="{local:Loc Upgrades_flow.IDS_Installed}" />
                                        </Grid>

                                        <Grid x:Name="OwnedTextBlock"
                                              Style="{StaticResource A_Style_FrameworkElement_ShowIfOwnedNotInstalled}">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarCost}"
                                                               Text="{local:Loc Upgrades_flow.IDS_Owned}" />
                                        </Grid>

                                        <Grid x:Name="InBasketTextBlock"
                                              Style="{StaticResource A_Style_FrameworkElement_ShowIfInBasket}">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarCost}"
                                                               Text="{local:Loc Upgrades_flow.IDS_InBasket}" />
                                        </Grid>

                                        <StackPanel Orientation="Horizontal"
                                                    Style="{StaticResource A_Style_FrameworkElement_ShowIfNotOwned}">
                                            <Grid>
                                                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Anthem/CarSelect/Credit_CarSelect.png"
                                                                  Color="{StaticResource A_Color_Footer_Text}"
                                                                  HorizontalAlignment="Left"
                                                                  GreedyMeasure="True"
                                                                  Stretch="Uniform" />
                                                <local:FZTextBlock Margin="50,0,0,0"
                                                                   Text="{Binding SelectedItem.PriceCredits, Converter={StaticResource A_NumUnitConverter_Units}, ElementName=PART_ItemList}"
                                                                   Style="{StaticResource A_Style_FZTextBlock_CarCost}" />
                                            </Grid>
                                            <Grid Visibility="{Binding AreTokensEnabled, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                  Margin="24,0,0,0">
                                                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Anthem/CarSelect/Token_CarSelect.png"
                                                                  Color="{StaticResource A_Color_Footer_Text}"
                                                                  HorizontalAlignment="Left"
                                                                  GreedyMeasure="True"
                                                                  Stretch="Uniform" />
                                                <local:FZTextBlock Margin="50,0,0,0"
                                                                    Text="{Binding SelectedItem.PriceTokens, Converter={StaticResource A_NumUnitConverter_Units}, ElementName=PART_ItemList}"
                                                                   Style="{StaticResource A_Style_FZTextBlock_CarCost}" />
                                            </Grid>
                                        </StackPanel>
                                    </Grid>
                                </Grid>
                                <local:FZMaterial x:Name="StatsPanel" Style="{StaticResource A_Style_FZMaterial_GlassPanel_NonInteractive}">
                                    <Grid Margin="26,22,26,22">
                                        <DockPanel x:Name="Grid_MainPartInfo">
                                            <DockPanel DockPanel.Dock="Bottom">
                                                <Control Style="{StaticResource A_Style_Control_DriveTrainDisplay}"
                                                         DataContext="{Binding Stats.Upgraded}"
                                                         DockPanel.Dock="Right"
                                                         HorizontalAlignment="Right" />
                                                <Control Style="{StaticResource A_Style_Control_CarClassBadge_Small_Default}"
                                                         DockPanel.Dock="Left"
                                                         local:BindingProxy.A="{Binding Stats.Upgraded.PerformanceIndex}"
                                                         local:BindingProxy.B="{Binding Stats.Upgraded.ClassID}"
                                                         HorizontalAlignment="Left" />

                                            </DockPanel>
                                            <Grid>
                                                <Grid x:Name="Grid_PerformanceBars"
                                                      VerticalAlignment="Center"
                                                      DataContext="{Binding Stats}"
                                                      Margin="0,0,0,10">
                                                    <StackPanel Orientation="Vertical" >
                                                        <local:DeltaProgressBar Style="{StaticResource A_Style_DeltaProgressBar_Upgrades_Speed}" />
                                                        <local:DeltaProgressBar Style="{StaticResource A_Style_DeltaProgressBar_Upgrades_Handling}" />
                                                        <local:DeltaProgressBar Style="{StaticResource A_Style_DeltaProgressBar_Upgrades_Acceleration}" />
                                                        <local:DeltaProgressBar Style="{StaticResource A_Style_DeltaProgressBar_Upgrades_Launch}" />
                                                        <local:DeltaProgressBar Style="{StaticResource A_Style_DeltaProgressBar_Upgrades_Braking}" />
                                                    </StackPanel>
                                                </Grid>
                                                <Grid x:Name="Grid_PerformanceStats"
                                                          Height="230"
                                                      VerticalAlignment="Center"
                                                          Visibility="Collapsed">
                                                    <Control Style="{StaticResource A_Style_Control_CarPerfStats}" Tag="{Binding Upgraded}" DataContext="{Binding Stats}"/>
                                                </Grid>
                                            </Grid>
                                        </DockPanel>
                                        <Control x:Name="Panel_BenchmarkInfo"
                                                 Visibility="Collapsed"
                                                 Template="{StaticResource A_Template_Control_Benchmark}"
                                                 DataContext="{Binding Benchmark}"/>
                                    </Grid>
                                </local:FZMaterial>
                            </DockPanel>

                            <Grid x:Name="Grid_AftermarketLogo"
                                      Margin="12"
                                      VerticalAlignment="Bottom"
                                      HorizontalAlignment="Right"
                                      Width="172"
                                      Height="172"
                                      DockPanel.Dock="Left"
                                      Visibility="Collapsed">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_AcrylicPanel_Tile_Background}" />
                                <local:FZMaterial ImageSource="{Binding SelectedItem.LogoPath, ElementName=PART_ItemList}" />
                            </Grid>

                            <DockPanel DockPanel.Dock="Bottom"
                                       LastChildFill="True">
                                
                                <ContentControl Style="{StaticResource A_Style_DockPanel_Basket}"
                                                DockPanel.Dock="Right"
                                                Margin="5,0,0,0"/>
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarCost}"
                                                       Margin="25,0"
                                                       Text="{Binding TuningInformation}" />
                                </local:FZMaterial>
                            </DockPanel>

                            <DockPanel Visibility="{Binding IsPerformanceGraphVisible, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                       Margin="0,0,0,5">
                                <ContentControl DockPanel.Dock="Top"
                                                    Content="{local:Loc UpgradeCar.IDS_Performance}"
                                                    Style="{StaticResource A_Style_ContentControl_Header}" />

                                <local:FZMaterial Grid.ColumnSpan="4"
                                                  Grid.RowSpan="3"
                                                  Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}">

                                    <DockPanel LastChildFill="True">
                                        <StackPanel DockPanel.Dock="Bottom"
                                                    HorizontalAlignment="Right"
                                                    Orientation="Horizontal"
                                                    Margin="0,0,7,7">

                                            <local:FZMaterial MinWidth="32"
                                                              Height="32"
                                                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"
                                                              Color="{StaticResource A_Color_Header_Background}">
                                                <local:FZTextBlock Text="{Binding TorqueLabel, ElementName=XYGraph, FallbackValue=Torque}"
                                                                   Style="{StaticResource A_Style_TextBlock_GraphLegendText}"
                                                                   VerticalAlignment="Center"
                                                                   Margin="15,0" />
                                            </local:FZMaterial>

                                            <local:FZMaterial MinWidth="32"
                                                              Height="32"
                                                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_InnerAll}"
                                                              Color="#FFEA7610"
                                                              Margin="8,0,0,0">
                                                <local:FZTextBlock Text="{Binding PowerLabel, ElementName=XYGraph, FallbackValue=Power}"
                                                                   Style="{StaticResource A_Style_TextBlock_GraphLegendText}"
                                                                   VerticalAlignment="Center"
                                                                   Margin="15,0" />
                                            </local:FZMaterial>

                                        </StackPanel>
                                        <Grid x:Name="Grid_Dyno"
                                              Margin="0,0,0,-20">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="16" />
                                                <ColumnDefinition Width="64" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="32" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="30" />
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="64" />
                                            </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}" />
                                            </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}" />
                                            </UniformGrid>
                                            <local:FZTextBlock Grid.Row="1"
                                                               Grid.Column="1"
                                                               Text="{Binding TextMaxPower, ElementName=XYGraph, FallbackValue=5000}"
                                                               Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                                               VerticalAlignment="Top"
                                                               HorizontalAlignment="Right"
                                                               Margin="0, 0, 16, 0" />
                                            <local:FZTextBlock Grid.Row="1"
                                                               Grid.Column="1"
                                                               Text="{Binding TextMidPower, ElementName=XYGraph, FallbackValue=2500}"
                                                               Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                                               VerticalAlignment="Center"
                                                               HorizontalAlignment="Right"
                                                               Margin="0, 0, 16, 0" />
                                            <local:FZTextBlock Grid.Row="2"
                                                               Grid.Column="1"
                                                               Text="0"
                                                               Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                                               VerticalAlignment="Top"
                                                               HorizontalAlignment="Right"
                                                               Margin="0, 10, 16, 0" />

                                            <local:FZTextBlock Grid.Row="3"
                                                               Grid.Column="2"
                                                               Text="{Binding TextMidRPM, ElementName=XYGraph, FallbackValue=5}"
                                                               Style="{StaticResource A_Style_TextBlock_PerformanceStatsLabelText}"
                                                               VerticalAlignment="Top"
                                                               HorizontalAlignment="Center"
                                                               Margin="0,10,0,0" />

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

                                                <StackPanel x:Name="StackPanel_DynoLegend"
                                                            Orientation="Horizontal"
                                                            HorizontalAlignment="Right">

                                                    <local:FZTextBlock Grid.Row="3"
                                                                       Grid.Column="2"
                                                                       Text="{Binding TextMaxRPM, ElementName=XYGraph, FallbackValue=10}"
                                                                       Style="{StaticResource A_Style_TextBlock_GraphLegendText}"
                                                                       VerticalAlignment="Top"
                                                                       HorizontalAlignment="Right"
                                                                       Margin="32, 10, 0, 0" />
                                                </StackPanel>
                                            </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"
                                                              Width="2"
                                                              HorizontalAlignment="Right" />

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

                        </DockPanel>
                    </DockPanel>
                </Grid>
            </Border>
        </Grid>

    </Grid>
</Page>
