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

    <local:NumUnitConverter x:Key="A_NumUnitConverter_Percent" FractionDigits="0" ShowUnit="False" />
    <local:NumUnitConverter x:Key="A_NumUnitConverter_PercentDecimated" FractionDigits="0" ShowUnit="False" Scale="0.1" />

    <!-- Brushes -->
    <SolidColorBrush x:Key="A_Brush_DarkPanelHeader" Color="{StaticResource A_Color_Header_Background}" />
    <SolidColorBrush x:Key="A_Brush_DarkPanelBackground" Color="{StaticResource A_Color_Description_Background}" />


    <!-- Font Sizes -->
    <System:Double x:Key="A_FontSize_Heading">40</System:Double>
    <System:Double x:Key="A_FontSize_Cell">24</System:Double>

    <!--@@@@@@@@@@@@@@@@@@@-->
    <!-- DESCRIPTION PANEL -->
    <!--@@@@@@@@@@@@@@@@@@@-->

    <Style x:Key="A_Style_DescriptionPanelHeader" TargetType="ContentControl" BasedOn="{StaticResource A_Style_ContentControl_Header}">
        <Setter Property="Height" Value="72" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_DescriptionBlockBody" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Body}" >
        <Setter Property="Color" Value="{StaticResource A_Color_Body_Text}" />
        <Setter Property="Stretch" Value="None" />
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_SidePanelContent" TargetType="ContentControl">
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}" >
            <ContentPresenter/>
        </local:FZMaterial>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_SidePanel" TargetType="ContentControl">
        <DockPanel>
            <ContentControl DockPanel.Dock="Top" Content="{TemplateBinding Tag}" Style="{StaticResource A_Style_DescriptionPanelHeader}" />
            <ContentControl DockPanel.Dock="Top" Content="{TemplateBinding Content}" Template="{DynamicResource A_ControlTemplate_SidePanelContent}" />
        </DockPanel>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_SidePanelWithMouseRollover" TargetType="ContentControl">
        <Grid>
            <DockPanel>
                <ContentControl DockPanel.Dock="Top" Content="{TemplateBinding Tag}" Style="{StaticResource A_Style_DescriptionPanelHeader}" />
                <ContentControl DockPanel.Dock="Top" Content="{TemplateBinding Content}" Template="{StaticResource A_ControlTemplate_SidePanelContent}" />
            </DockPanel>
            <Control Style="{StaticResource A_Style_Control_MouseRollover_Outer_All}"
                     Visibility="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=ContentControl}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_AutoScrollPanel_OptionsDescription" BasedOn="{StaticResource A_Style_AutoScrollPanel_Masked}" TargetType="local:AutoScrollPanel">
        <Style.Resources>
            <Style x:Key="A_Style_FZRun_Description_Markup_BOLD" TargetType="local:FZRun">
                <Setter Property="FontFamily" Value="Horizon_C"/>
            </Style>
            <ControlTemplate x:Key="A_ControlTemplate_AutoscrollTemplate_Dynamic">
                <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding AnimationContext, RelativeSource={RelativeSource FindAncestor, AncestorType=local:AutoScrollPanel}}"
                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_Description_Markup_"
                                   Style="{StaticResource A_Style_FZTextBlock_DescriptionBlockBody}"
                                   Color="{StaticResource A_Color_Body_Text}"
                                   Margin="0"
                                   TextWrapping="Wrap" />
            </ControlTemplate>
        </Style.Resources>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_ContentControl_DescriptionPanel_DescriptionText"
                     TargetType="ContentControl">
        <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_OptionsDescription}"
                               AnimationContext="{TemplateBinding Content}"
                               Margin="24"
                               local:ScreenReader.Line="{Binding Content, Converter={StaticResource A_Converter_TrimInlineMarkup}, RelativeSource={RelativeSource TemplatedParent}}"
                               local:ScreenReader.LineType="ItemDescription"
                               local:ScreenReader.Event="OnChange"/>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_DescriptionPanel"
                     TargetType="ContentControl">
        <ContentControl Template="{StaticResource A_ControlTemplate_SidePanel}"
                        Tag="{local:Loc Assists.IDS_Title_Description}">
            <ContentControl Template="{StaticResource A_ControlTemplate_ContentControl_DescriptionPanel_DescriptionText}"
                            Content="{TemplateBinding Content}" />
        </ContentControl>
    </ControlTemplate>

    <Style x:Key="A_Style_DescriptionPanel" TargetType="ContentControl">
        <Setter Property="Width" Value="354" />
        <Setter Property="Height" Value="686" />
        <Setter Property="Margin" Value="6,-0.5,0,0" />
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_DescriptionPanel}"/>
    </Style>

    <Style x:Key="A_Style_DescriptionPanel_Options" BasedOn="{StaticResource A_Style_DescriptionPanel}" TargetType="ContentControl">
        <Setter Property="Height" Value="661" />
    </Style>

    <!--@@@@@@@@-->
    <!-- SLIDER -->
    <!--@@@@@@@@-->

    <!-- Focused Bar -->
    <Style x:Key="A_Style_RepeatButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <local:FZMaterial x:Name="Background"  Color="{StaticResource A_Color_Slider_Foreground_Deselected}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_RepeatButton_Left"
           TargetType="{x:Type RepeatButton}"
           BasedOn="{StaticResource A_Style_RepeatButton}">
        <Setter Property="Margin"
                Value="0,0,-2,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <local:FZMaterial x:Name="MouseHitTestHelper" Opacity="0" />
                        <local:FZMaterial x:Name="Background"
                                          Color="{StaticResource A_Color_Slider_Foreground_Deselected}"
                                          Height="4">
                            <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle CornerRadius="2" />
                            </local:FZMaterial.Preset>
                        </local:FZMaterial>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                                     Value="True">
                            <Setter TargetName="Background"
                                    Property="Color"
                                    Value="{StaticResource A_Color_Slider_Selected}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_RepeatButton_Right"
           TargetType="{x:Type RepeatButton}"
           BasedOn="{StaticResource A_Style_RepeatButton}">
        <Setter Property="Margin"
                Value="-2,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <local:FZMaterial x:Name="MouseHitTestHelper" Opacity="0" />
                        <local:FZMaterial x:Name="Background"
                                          Color="{StaticResource A_Color_Slider_Foreground_RightTrack}"
                                          Height="4">
                            <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle CornerRadius="2" />
                            </local:FZMaterial.Preset>
                        </local:FZMaterial>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}, Path=IsKeyboardFocusWithin}"
                                     Value="True">
                            <Setter TargetName="Background"
                                    Property="Color"
                                    Value="{StaticResource A_Color_Slider_Foreground_RightTrack_Selected}" />
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_Thumb_OptionsSlider" TargetType="{x:Type Thumb}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <local:FZMaterial x:Name="HighlightShadow"
                                      Style="{StaticResource A_Style_FZMaterial_HighlightShadow}"
                                      CaptureSubgraph="False"
                                      Width="70"
                                      Margin="-1,0,-52,0">
                        <local:FZMaterial x:Name="OuterMaterial" Color="{StaticResource A_Color_Slider_Foreground_Deselected}"
                                          Width="18"
                                          Height="18"
                                          HorizontalAlignment="Left">
                              <local:FZMaterial.Preset>
                                <local:FZMaterialPresetRoundtangle CornerRadius="9"/>
                            </local:FZMaterial.Preset>
                            <local:FZMaterial x:Name="CenterMaterial"
                                              Color="{StaticResource A_Color_Slider_Foreground_Deselected}"
                                              Margin="2"
                                              Visibility="{Binding IsControllerActiveInput, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, RelativeSource={RelativeSource AncestorType=Page}}">
                                <local:FZMaterial.Preset>
                                    <local:FZMaterialPresetRoundtangle CornerRadius="7"/>
                                </local:FZMaterial.Preset>
                            </local:FZMaterial>
                        </local:FZMaterial>
                    </local:FZMaterial>
                    <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_Selected}" />
                            <Setter TargetName="HighlightShadow"
                                    Property="CaptureSubgraph"
                                    Value="True" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsMouseOver, ElementName=CenterMaterial}"
                                     Value="True">
                            <Setter TargetName="CenterMaterial"
                                    Property="Color"
                                    Value="{StaticResource A_Color_Slider_Selected}" />
                        </DataTrigger>
                        <Trigger Property="IsDragging"
                                 Value="True">
                            <Setter TargetName="CenterMaterial"
                                    Property="Color"
                                    Value="{StaticResource A_Color_Slider_Selected}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_SliderControlText" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}" TargetType="local:FZTextBlock">
        <Setter Property="Color"
                Value="{StaticResource A_Color_TextMenu_Text_Default}" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection"
                Value="DownOnly" />
        <Setter Property="FontSize" Value="22"/>
        <Setter Property="IsHitTestVisible" Value="False"/>
    </Style>

    <Style x:Key="A_Style_SliderControlText_Value" BasedOn="{StaticResource A_Style_SliderControlText}" TargetType="local:FZTextBlock">
        <Setter Property="FontFamily" Value="Horizon_C" />
        <Setter Property="HorizontalAlignment"
                Value="Right" />
        <Setter Property="TextAlignment"
                Value="Right" />
        <Setter Property="DockPanel.Dock"
                Value="Right" />
    </Style>

    <Style x:Key="A_Style_Track_OptionsSlider"
           TargetType="Track">
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="Height"
                Value="{Binding Height, RelativeSource={RelativeSource AncestorType=Slider}}" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_SpinnerTitle" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}" TargetType="local:FZTextBlock">
        <Setter Property="Color"
                Value="{StaticResource A_Color_TextMenu_Text_Default}" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Margin" Value="-2,1,0,0" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection" Value="DownOnly" />
        <Setter Property="FontSize" Value="22" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_OptionsSlider_MouseHitHelper" TargetType="local:FZMaterial">
        <Setter Property="Color" Value="#00000000" />
        <Setter Property="Height" Value="25" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="Margin" Value="24, 0, -12, 0"/>
    </Style>

    <Style x:Key="A_Style_Slider_Options_Internal"
           TargetType="Slider">
        <Setter Property="FocusManager.IsFocusScope"
                Value="True" />
        <Setter Property="SmallChange"
                Value="0.01" />
        <Setter Property="LargeChange"
                Value="0" />
        <Setter Property="Minimum"
                Value="0" />
        <Setter Property="Maximum"
                Value="1" />
        <Setter Property="IsMoveToPointEnabled"
                Value="True" />
        <Setter Property="local:BindingProxy.A"
                Value="{Binding Tag.Heading, RelativeSource={RelativeSource Self}}" />
        <Setter Property="local:BindingProxy.B"
                Value="{Binding Value, RelativeSource={RelativeSource Self}, ConverterParameter=fracpercentage, Converter={StaticResource A_NumUnitConverter_Percent}}" />
        <Setter Property="local:BindingProxy.TunnelOut"
                Value="{Binding (local:BindingProxy.C), RelativeSource={RelativeSource AncestorType=ListBoxItem}, Mode=OneWayToSource}"/>
        <Setter Property="local:BindingProxy.AlwaysValidNumeric"
                Value="70"/>
        <Setter Property="local:ScreenReader.SelectedNumber"
                Value="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Converter={StaticResource A_IndexToNumberConverter}, FallbackValue=0}" />
        <Setter Property="local:ScreenReader.SelectedCount"
                Value="{Binding Items.Count, RelativeSource={RelativeSource AncestorType={x:Type Selector}}, FallbackValue=0}"/>
      <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}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <local:FZMaterial x:Name="LabelTextHighlightShadow"
                                          Style="{StaticResource A_Style_FZMaterial_HighlightShadow}"
                                          CaptureSubgraph="False">
                            <local:FZTextBlock x:Name="PART_Label"
                                               Text="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource A_StringToUpper}}"
                                               local:ScreenReader.Event="OnChange"
                                               local:ScreenReader.ControlType="Slider"
                                               local:ScreenReader.LineType="SelectedItem"
                                               Style="{StaticResource A_Style_SliderControlText}"
                                               local:ScreenReader.SelectedNumber="{Binding (local:ScreenReader.SelectedNumber), RelativeSource={RelativeSource AncestorType={x:Type Slider}}}"
                                               local:ScreenReader.SelectedCount="{Binding (local:ScreenReader.SelectedCount), RelativeSource={RelativeSource AncestorType={x:Type Slider}}}" />
                        </local:FZMaterial>

                        <DockPanel Grid.Column="1"
                                   Margin="35,0,0,0">
                            <local:FZMaterial x:Name="ValueTextHighlightShadow"
                                              Style="{StaticResource A_Style_FZMaterial_HighlightShadow}"
                                              CaptureSubgraph="False"
                                              DockPanel.Dock="Right"
                                              Margin="0,0,-18,0"
                                              Width="{Binding (local:BindingProxy.AlwaysValidNumeric), RelativeSource={RelativeSource TemplatedParent}}">
                                <local:FZTextBlock x:Name="PART_ValueText"
                                                   Text="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}"
                                                   Style="{StaticResource A_Style_SliderControlText_Value}"
                                                   Margin="4,0,18,0"
                                                   local:ScreenReader.Event="OnChange"
                                                   local:ScreenReader.LineType="SelectedValue" />
                            </local:FZMaterial>
                            <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>
                        </DockPanel>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocusWithin"
                                 Value="True">
                            <Setter Property="Color" TargetName="PART_ValueText" Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                            <Setter Property="Color" TargetName="PART_Label" Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                            <Setter Property="CaptureSubgraph" TargetName="LabelTextHighlightShadow" Value="True" />
                            <Setter Property="CaptureSubgraph" TargetName="ValueTextHighlightShadow" Value="True" />
                            <Setter Property="local:ScreenReader.Line" TargetName="PART_Label" Value="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}" />
                            <Setter Property="local:ScreenReader.Line" TargetName="PART_ValueText" Value="{Binding (local:BindingProxy.B), RelativeSource={RelativeSource TemplatedParent}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_Slider_Options_InItemsList"
           BasedOn="{StaticResource A_Style_Slider_Options_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 x:Key="A_Style_Slider_Options_WheelRotationAngle"
           BasedOn="{StaticResource A_Style_Slider_Options_InItemsList}"
           TargetType="Slider">
        <Setter Property="local:BindingProxy.B"
                Value="{Binding Value, RelativeSource={RelativeSource Self}, Converter={StaticResource A_NumUnitConverter_Percent}}" />
        <Setter Property="SmallChange"
                Value="30" />
        <Setter Property="LargeChange"
                Value="0" />
        <Setter Property="Minimum"
                Value="270" />
        <Setter Property="Maximum"
                Value="900" />
        <Setter Property="IsMoveToPointEnabled"
                Value="True" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding CanChangeSteeringWheelRotationAngle}">
                <DataTrigger.Value>
                    <System:Boolean>False</System:Boolean>
                </DataTrigger.Value>
                <Setter Property="SmallChange"
                        Value="0" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>
