<Page DataContext="{Binding RelativeSource={RelativeSource Self}}"
      Style="{StaticResource A_Style_Page_Generic}"
      mc:Ignorable="d"
      x:Class="ForzaUI.Scenes.Anthem.A_TuningOptions"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}" />
    </local:UIPageTransitionManager.TransitionManager>
    <Page.Resources>
        <ResourceDictionary>
            <Color x:Key="A_Color_DynoGraphBackground">#00AAAAAA</Color>
            <Style BasedOn="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                   TargetType="DockPanel"
                   x:Key="A_Style_DockPanel_SideBlock">
                <Setter Property="Height"
                        Value="660" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_Body}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Tuning_DescriptionBlockBody">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Body_Text}" />
                <Setter Property="TextWrapping"
                        Value="Wrap" />
                <Setter Property="Stretch"
                        Value="None" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_OptionText}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Tune_ItemLabel">
                <Setter Property="Margin"
                        Value="0" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_OptionText}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Tune_ItemValue">
                <Setter Property="FontFamily"
                        Value="Horizon_C" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_Tune_ItemValue}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Tune_ItemHeader">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
            </Style>
            <Style TargetType="ItemsControl"
                   x:Key="A_Style_ItemsControl_1x2Grid_EqualSpaced">
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <Grid IsItemsHost="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                            </Grid>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <System:Double x:Key="A_Double_Tuning_SliderWidth">270</System:Double>
            <System:Double x:Key="A_Double_Tuning_ValueWidth">105</System:Double>
            <Style TargetType="FrameworkElement"
                   x:Key="A_Style_TuningSliderColumn">
                <Setter Property="Width"
                        Value="{StaticResource A_Double_Tuning_SliderWidth}" />
                <Setter Property="DockPanel.Dock"
                        Value="Right" />
            </Style>
            <Style TargetType="FrameworkElement"
                   x:Key="A_Style_TuningValueColumn">
                <Setter Property="Width"
                        Value="{StaticResource A_Double_Tuning_ValueWidth}" />
                <Setter Property="DockPanel.Dock"
                        Value="Right" />
            </Style>
            <Style TargetType="DockPanel"
                   x:Key="A_Style_DockPanel_1x3_TuningSpaced">
                <Setter Property="Height"
                        Value="{StaticResource A_Double_TextMenu_Height_Default}" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_ListBox_List_Default}"
                   TargetType="{x:Type local:CommonListBox}"
                   x:Key="A_Style_ListBox_List_Tuning">
                <Setter Property="Focusable"
                        Value="False" />
                <Setter Property="AllowMouseWheelScrolling"
                        Value="False" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}"
                   TargetType="ListBoxItem"
                   x:Key="A_Style_ListBoxItem_List_Tuning">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsHeader}">
                        <DataTrigger.Value>
                            <System:Boolean>True</System:Boolean>
                        </DataTrigger.Value>
                        <Setter Property="Tag"
                                Value="GroupHeader" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="A_Style_Thumb_OptionsSlider_History"
                   TargetType="{x:Type Thumb}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Thumb}">
                            <Grid>
                                <local:FZMaterial x:Name="OuterMaterial"
                                                  Color="{StaticResource A_Color_Slider_Foreground_RightTrack}"
                                                  Width="17.5"
                                                  Height="17.5"
                                                  HorizontalAlignment="Center"
                                                  VerticalAlignment="Center">
                                    <local:FZMaterial.Preset>
                                        <local:FZMaterialPresetRoundtangle CornerRadius="8.75" />
                                    </local:FZMaterial.Preset>
                                </local:FZMaterial>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                                             Value="True">
                                    <Setter TargetName="OuterMaterial"
                                            Property="Color"
                                            Value="{StaticResource A_Color_Slider_Foreground_RightTrack_Selected}" />
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_Slider_Tuning_Internal"
                   TargetType="Slider">
                <Setter Property="FocusManager.IsFocusScope"
                        Value="True" />
                <Setter Property="SmallChange"
                        Value="{Binding SmallChange}" />
                <Setter Property="LargeChange"
                        Value="{Binding LargeChange}" />
                <Setter Property="Minimum"
                        Value="{Binding Minimum}" />
                <Setter Property="Maximum"
                        Value="{Binding Maximum}" />
                <Setter Property="Value"
                        Value="{Binding Value, Mode=TwoWay}" />
                <Setter Property="IsMoveToPointEnabled"
                        Value="True" />
                <Setter Property="local:BindingProxy.TunnelOut"
                        Value="{Binding (local:BindingProxy.C), RelativeSource={RelativeSource AncestorType=ListBoxItem}, Mode=OneWayToSource}" />
                <Setter Property="local:BindingProxy.TunnelIn">
                    <Setter.Value>
                        <!-- Turn off streak shadows for the contents of the list box item, we need to do it ourselves.
                     Look for a trigger to BindingProxy.C in A_ControlTemplate_TextMenu_Default -->
                        <System:Boolean>False</System:Boolean>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Slider">
                            <Grid FocusManager.IsFocusScope="True"
                                  Margin="{DynamicResource A_Thickness_Slider_ContentsMargin}">
                                <Track Style="{StaticResource A_Style_Track_OptionsSlider}"
                                       Value="{Binding History}">
                                    <Track.Thumb>
                                        <Thumb Style="{StaticResource A_Style_Thumb_OptionsSlider_History}" />
                                    </Track.Thumb>
                                </Track>
                                <local:FZMaterial Width="12"
                                                  Height="8"
                                                  x:Name="Centre"
                                                  Margin="0,0,0,5"
                                                  HorizontalAlignment="Center"
                                                  VerticalAlignment="Bottom"
                                                  Visibility="Collapsed"
                                                  Color="{StaticResource A_Color_Slider_Foreground_Deselected}"
                                                  ImageSource="/ForzaUI;component/Textures/Anthem/A_Slider_Center.png" />
                                <Grid IsHitTestVisible="False"
                                      x:Name="BidiTrack"
                                      Visibility="Hidden">
                                    <local:FZMaterial x:Name="BidiBg"
                                                      Color="{StaticResource A_Color_Slider_Foreground_RightTrack}"
                                                      Height="4">
                                        <local:FZMaterial.Preset>
                                            <local:FZMaterialPresetRoundtangle CornerRadius="2" />
                                        </local:FZMaterial.Preset>
                                    </local:FZMaterial>
                                    <UniformGrid Columns="2">
                                        <Track Style="{StaticResource A_Style_Track_OptionsSlider}"
                                               Maximum="{Binding Middle}">
                                            <Track.IncreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource A_Style_RepeatButton_Left}"
                                                              Margin="0" />
                                            </Track.IncreaseRepeatButton>
                                        </Track>
                                        <Track Style="{StaticResource A_Style_Track_OptionsSlider}"
                                               Minimum="{Binding Middle}">
                                            <Track.DecreaseRepeatButton>
                                                <RepeatButton Style="{StaticResource A_Style_RepeatButton_Left}"
                                                              Margin="0" />
                                            </Track.DecreaseRepeatButton>
                                        </Track>
                                    </UniformGrid>
                                </Grid>
                                <Track x:Name="PART_Track"
                                       Style="{StaticResource A_Style_Track_OptionsSlider}">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton x:Name="Left"
                                                      Style="{StaticResource A_Style_RepeatButton_Left}" />
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton x:Name="Right"
                                                      Style="{StaticResource A_Style_RepeatButton_Right}" />
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb x:Name="Thumb"
                                               Style="{StaticResource A_Style_Thumb_OptionsSlider}" />
                                    </Track.Thumb>
                                </Track>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                                             Value="True">
                                    <Setter TargetName="Centre"
                                            Property="Color"
                                            Value="{StaticResource A_Color_Slider_Selected}" />
                                    <Setter TargetName="BidiBg"
                                            Property="Color"
                                            Value="{StaticResource A_Color_Slider_Foreground_RightTrack_Selected}" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding Bidirectional}"
                                             Value="True">
                                    <Setter TargetName="BidiTrack"
                                            Property="Visibility"
                                            Value="Visible" />
                                    <Setter TargetName="Centre"
                                            Property="Visibility"
                                            Value="Visible" />
                                    <Setter TargetName="Left"
                                            Property="Opacity"
                                            Value="0" />
                                    <Setter TargetName="Right"
                                            Property="Opacity"
                                            Value="0" />
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsReadOnly}"
                                 Value="True">
                        <Setter Property="IsHitTestVisible"
                                Value="False" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Slider_Tuning_InItemsList"
                   BasedOn="{StaticResource A_Style_Slider_Tuning_Internal}"
                   TargetType="Slider">
                <Style.Resources>
                    <Thickness x:Key="A_Thickness_Slider_ContentsMargin">18,0</Thickness>
                </Style.Resources>
                <Setter Property="Height"
                        Value="{StaticResource A_Double_TextMenu_Height_Default}" />
            </Style>

            <Style BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Small_Tight}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Dyno_Label">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_Header_Text}" />
                <Setter Property="FontFamily"
                        Value="Horizon_A" />
                <Setter Property="CapHeight"
                        Value="15" />
                <Setter Property="FontSize"
                        Value="{StaticResource A_Double_FontSize_Minimum}" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Small_Tight}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_Dyno_Legend">
                <Setter Property="Color"
                        Value="White" />
                <Setter Property="FontFamily"
                        Value="Horizon_B" />
                <Setter Property="CapHeight"
                        Value="15" />
                <Setter Property="Stretch"
                        Value="None" />
            </Style>
            <Style TargetType="{x:Type local:FZMaterial}"
                   x:Key="A_Style_Material_DynoBorder">
                <Setter Property="Color"
                        Value="White" />
            </Style>
            <SolidColorBrush Color="White"
                             x:Key="A_Brush_DynoGraphLine" />
            <Style TargetType="{x:Type Path}"
                   x:Key="A_Style_Path_DynoGraphVertLine">
                <Setter Property="Data"
                        Value="M0,0 L0,-458" />
                <Setter Property="Stroke"
                        Value="{StaticResource A_Brush_DynoGraphLine}" />
                <Setter Property="StrokeThickness"
                        Value="1" />
                <Setter Property="Opacity"
                        Value="0.3" />
                <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" />
            </Style>
            <Style TargetType="{x:Type Path}"
                   x:Key="A_Style_Path_DynoGraphHorzLine">
                <Setter Property="Data"
                        Value="M0,0 L1920,0" />
                <Setter Property="Stroke"
                        Value="{StaticResource A_Brush_DynoGraphLine}" />
                <Setter Property="StrokeThickness"
                        Value="1" />
                <Setter Property="Opacity"
                        Value="0.3" />
                <Setter Property="StrokeEndLineCap"
                        Value="Square" />
                <Setter Property="VerticalAlignment"
                        Value="Bottom" />
            </Style>
            <Style BasedOn="{StaticResource A_Style_AutoScrollPanel_Masked}"
                   TargetType="local:AutoScrollPanel"
                   x:Key="A_Style_AutoScrollPanel_Masked_Tuning">
                <Setter Property="Margin"
                        Value="25" />
            </Style>
            <DataTemplate DataType="{x:Type local:SliderViewModel}">
                <DockPanel Style="{StaticResource A_Style_DockPanel_1x3_TuningSpaced}">
                    <Grid Style="{StaticResource A_Style_TuningValueColumn}">
                        <local:FZMaterial x:Name="ValueShadow"
                                          CaptureSubgraph="False"
                                          Style="{StaticResource A_Style_FZMaterial_HighlightShadow}">
                            <Grid Margin="0,0,20,0"
                                  HorizontalAlignment="Right">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Tune_ItemValue}"
                                                   Text="{Binding Text}"
                                                   Margin="0"
                                                   x:Name="Value" />
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TextMenu_LockIcon}"
                                                  Visibility="{Binding IsReadOnly, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Hidden}"
                                                  Margin="0,-16,0,-16" />
                            </Grid>
                        </local:FZMaterial>
                    </Grid>
                    <Grid Style="{StaticResource A_Style_TuningSliderColumn}">
                        <Slider Style="{StaticResource A_Style_Slider_Tuning_InItemsList}" />
                    </Grid>
                    <local:FZMaterial x:Name="HeaderShadow"
                                      CaptureSubgraph="False"
                                      Style="{StaticResource A_Style_FZMaterial_HighlightShadow}">
                        <local:FZTextBlock HorizontalAlignment="Left"
                                           Margin="20,0,0,0"
                                           Style="{StaticResource A_Style_FZTextBlock_Tune_ItemLabel}"
                                           Text="{Binding Title, Converter={StaticResource A_StringToUpper}}" />
                    </local:FZMaterial>
                </DockPanel>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
                                 Value="True">
                        <Setter TargetName="HeaderShadow"
                                Property="CaptureSubgraph"
                                Value="True" />
                        <Setter TargetName="ValueShadow"
                                Property="CaptureSubgraph"
                                Value="True" />
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
            <DataTemplate DataType="{x:Type local:TuningHeader}">
                <DockPanel Style="{StaticResource A_Style_DockPanel_1x3_TuningSpaced}">
                    <Grid Style="{StaticResource A_Style_TuningValueColumn}">
                        <local:FZTextBlock HorizontalAlignment="Right"
                                           Margin="0,0,20,0"
                                           Style="{StaticResource A_Style_FZTextBlock_Tune_ItemHeader}"
                                           Text="{Binding Units, Converter={StaticResource A_StringToUpper}}" />
                    </Grid>
                    <Grid Style="{StaticResource A_Style_TuningSliderColumn}">
                        <local:FZTextBlock HorizontalAlignment="Left"
                                           Style="{StaticResource A_Style_FZTextBlock_Tune_ItemHeader}"
                                           Text="{Binding Min}" />
                        <local:FZTextBlock HorizontalAlignment="Right"
                                           Style="{StaticResource A_Style_FZTextBlock_Tune_ItemHeader}"
                                           Text="{Binding Max}" />
                    </Grid>
                    <local:FZTextBlock HorizontalAlignment="Left"
                                       Style="{StaticResource A_Style_FZTextBlock_Tune_ItemHeader}"
                                       Margin="20,0,0,0"
                                       Text="{Binding Title}" />
                </DockPanel>
            </DataTemplate>

            <local:LinearTransformConverter Add="-2"
                                            x:Key="A_Converter_SelectedGearToGraphIndex" />

            <Style x:Key="A_Style_TransGraphRenderer_Tuning"
                   TargetType="{x:Type local:TransGraphRenderer}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedIndex, ElementName=ChassisTuningGroupList}"
                                 Value="1">
                        <Setter Property="SelectGear"
                                Value="{Binding SelectedIndex, ElementName=OptionList, Converter={StaticResource A_Converter_SelectedGearToGraphIndex}}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_VisibleWhenGearing"
                   TargetType="{x:Type FrameworkElement}">
                <Setter Property="Visibility"
                        Value="Collapsed" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedIndex, ElementName=ChassisTuningGroupList}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Visible" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_TuneHelp_Bold"
                   TargetType="{x:Type local:FZRun}">
                <Setter Property="FontFamily"
                        Value="Horizon_C" />
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <!-- Background Blur -->
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <!-- Bars -->
        <local:PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                                x:Name="TopBar" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <ContentControl Name="DefaultHelpPanel"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            local:ControllerButtonPanel.BackDescription="{local:Loc HelpButtons.IDS_SaveLoadDefault}"
                            local:ControllerButtonPanel.XDescription="{local:Loc ScreenTitles.IDS_UpgradeCarMainTitle}"
                            local:ControllerButtonPanel.YDescription="{local:Loc HelpButtons.IDS_Test_Drive}" />
        </ContentControl>
        <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}"
                x:Name="LayoutRoot">
            <Grid>
                <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                    <StackPanel>
                        <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                                    local:UIPageTransitionManager.TransitionIndex="0">
                            <ContentControl Content="{local:Loc ScreenTitles.IDS_TuneCar}"
                                            HorizontalAlignment="Left"
                                            Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Tuning.png" />
                        </StackPanel>
                        <Decorator HorizontalAlignment="Left"
                                   Margin="0,0,0,16"
                                   Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}"
                                   VerticalAlignment="Top">
                            <local:ItemsSelector Focusable="False"
                                                 Grid.Column="2"
                                                 ItemsSource="{Binding Categories}"
                                                 PageSize="1"
                                                 SelectedIndex="-1"
                                                 Style="{StaticResource A_Style_TextTabMenuList}"
                                                 x:Name="ChassisTuningGroupList" />
                        </Decorator>
                        <DockPanel HorizontalAlignment="Stretch"
                                   VerticalAlignment="Top">
                            <!-- Left-hand-side Panel; Benchmark -->
                            <DockPanel Margin="0,0,10,0"
                                       Style="{StaticResource A_Style_DockPanel_SideBlock}"
                                       Width="432"
                                       local:UIPageTransitionManager.TransitionIndex="2">
                                <ContentControl Content="{local:Loc Tuning.IDS_Performance}"
                                                DockPanel.Dock="Top"
                                                Style="{StaticResource A_Style_ContentControl_Header}" />
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}"
                                                  VerticalAlignment="Stretch">

                                    <Control x:Name="Panel_BenchmarkInfo"
                                             Margin="24,27"
                                             Template="{StaticResource A_Template_Control_Benchmark}"
                                             DataContext="{Binding Benchmark}" />
                                </local:FZMaterial>
                            </DockPanel>
                            <!-- Right-hand-side Panel; Description & Gearing Ratios-->
                            <DockPanel DockPanel.Dock="Right"
                                       Margin="10,0,0,0"
                                       Style="{StaticResource A_Style_DockPanel_SideBlock}"
                                       Width="426"
                                       local:UIPageTransitionManager.TransitionIndex="4">
                                <!-- Gearing Ratios -->
                                <StackPanel DockPanel.Dock="Bottom"
                                            Margin="0,5,0,0"
                                            Orientation="Vertical"
                                            Style="{StaticResource A_Style_VisibleWhenGearing}">
                                    <Grid>
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}" />
                                        <Grid Margin="24">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="33" />
                                                <ColumnDefinition Width="24" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="24" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <local:FZMaterial Grid.Column="2"
                                                              Grid.Row="0"
                                                              Style="{StaticResource A_Style_Material_DynoBorder}"
                                                              Width="2"
                                                              HorizontalAlignment="Left" />
                                            <local:FZMaterial Grid.Column="2"
                                                              Grid.Row="0"
                                                              Style="{StaticResource A_Style_Material_DynoBorder}"
                                                              Height="2"
                                                              VerticalAlignment="Bottom" />
                                            <local:FZMaterial Grid.Column="2"
                                                              Grid.Row="0"
                                                              Style="{StaticResource A_Style_Material_DynoBorder}"
                                                              Width="1"
                                                              Opacity="0.3"
                                                              HorizontalAlignment="Right" />
                                            <UniformGrid ClipToBounds="True"
                                                         Grid.Column="2"
                                                         Grid.Row="0"
                                                         Rows="8">
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphHorzLine}" />
                                            </UniformGrid>
                                            <UniformGrid ClipToBounds="True"
                                                         Columns="10"
                                                         Grid.Column="2"
                                                         Grid.Row="0">
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                                <Path Style="{StaticResource A_Style_Path_DynoGraphVertLine}" />
                                            </UniformGrid>
                                            <local:FZTextBlock Grid.Column="1"
                                                               Grid.Row="0"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,4,5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Label}"
                                                               Text="{Binding TextMaxRPM, ElementName=GearGraph}" />
                                            <local:FZTextBlock Grid.Column="1"
                                                               Grid.Row="0"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Label}"
                                                               Text="{Binding TextMidRPM, ElementName=GearGraph}"
                                                               VerticalAlignment="Center" />
                                            <local:FZTextBlock Grid.Column="1"
                                                               Grid.Row="1"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Label}"
                                                               Text="{local:Loc Main.IDS_Zero}"
                                                               VerticalAlignment="Center" />
                                            <local:FZTextBlock Grid.Column="2"
                                                               Grid.Row="1"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Label}"
                                                               Text="{Binding TextMidSpeed, ElementName=GearGraph}"
                                                               VerticalAlignment="Center" />
                                            <local:FZTextBlock Grid.Column="2"
                                                               Grid.Row="1"
                                                               HorizontalAlignment="Right"
                                                               Margin="5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Label}"
                                                               Text="{Binding TextMaxSpeed, ElementName=GearGraph}"
                                                               VerticalAlignment="Center" />
                                            <local:FZTextBlock Grid.Column="2"
                                                               Grid.Row="2"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,8,5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Legend}"
                                                               Text="{Binding TextSpeedUnits, ElementName=GearGraph}"
                                                               VerticalAlignment="Center" />
                                            <local:FZTextBlock Grid.Column="0"
                                                               Grid.Row="0"
                                                               HorizontalAlignment="Center"
                                                               Margin="5,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_Dyno_Legend}"
                                                               Text="{local:Loc UpgradeCar.IDS_RPM}"
                                                               TextAlignment="Center"
                                                               VerticalAlignment="Center">
                                                <local:FZTextBlock.LayoutTransform>
                                                    <TransformGroup>
                                                        <ScaleTransform />
                                                        <SkewTransform />
                                                        <RotateTransform Angle="-90" />
                                                        <TranslateTransform />
                                                    </TransformGroup>
                                                </local:FZTextBlock.LayoutTransform>
                                            </local:FZTextBlock>
                                            <local:TransGraphRenderer ClipToBounds="True"
                                                                      Grid.Column="2"
                                                                      Grid.Row="0"
                                                                      Height="192"
                                                                      MapId="gearing"
                                                                      MapProfile="geargraph"
                                                                      Width="340"
                                                                      x:Name="GearGraph"
                                                                      Style="{StaticResource A_Style_TransGraphRenderer_Tuning}" />
                                        </Grid>


                                    </Grid>
                                </StackPanel>
                                <!-- Description -->
                                <DockPanel>
                                    <ContentControl Content="{local:Loc Assists.IDS_Title_Description}"
                                                    DockPanel.Dock="Top"
                                                    Style="{StaticResource A_Style_ContentControl_Header}" />
                                    <Grid>
                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}" />
                                        <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_Masked_Tuning}"
                                                               AnimationContext="{Binding SelectedItem.Help, ElementName=OptionList}">
                                            <local:AutoScrollPanel.Resources>
                                                <ControlTemplate x:Key="A_ControlTemplate_AutoscrollTemplate_Dynamic">
                                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Tuning_DescriptionBlockBody}"
                                                                       local:TextBlockInlineMarkup.Markup="{Binding AnimationContext, RelativeSource={RelativeSource AncestorType=local:AutoScrollPanel}}"
                                                                       local:TextBlockInlineMarkup.ResourceBaseName="A_Style_TuneHelp_" />
                                                </ControlTemplate>
                                            </local:AutoScrollPanel.Resources>
                                        </local:AutoScrollPanel>
                                    </Grid>
                                </DockPanel>
                            </DockPanel>
                            <!-- Centre Panel; Tuning options -->
                            <Grid DockPanel.Dock="Top"
                                  HorizontalAlignment="Stretch"
                                  Margin="0,2,0,0"
                                  Panel.ZIndex="1"
                                  Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
                                  VerticalAlignment="Top"
                                  local:UIPageTransitionManager.TransitionIndex="3">
                                <local:CommonListBox ItemContainerStyle="{StaticResource A_Style_ListBoxItem_List_Tuning}"
                                                     ItemTemplate="{x:Null}"
                                                     ItemsSource="{Binding SelectedItem.Options, ElementName=ChassisTuningGroupList}"
                                                     KeyboardNavigation.DirectionalNavigation="Contained"
                                                     Style="{StaticResource A_Style_ListBox_List_Tuning}"
                                                     x:Name="OptionList" />
                            </Grid>
                        </DockPanel>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</Page>
