<Page xmlns:local="clr-namespace:ForzaUI"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      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"
      x:Class="ForzaUI.A_VideoOptions"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding DataSource, RelativeSource={RelativeSource Self}}"
      >

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

    <Page.Resources>
        <ResourceDictionary>

            <!-- HDR WhitePoint Settings -->
            <System:Double x:Key="A_Double_HDRWhitePoint_Minimum">400</System:Double>
            <System:Double x:Key="A_Double_HDRWhitePoint_Maximum">10000</System:Double>
            <System:Double x:Key="A_Double_HDRWhitePoint_SmallChange">100</System:Double>
            <System:Double x:Key="A_Double_HDRWhitePoint_MaximumReciprocal">0.01</System:Double>
            <System:Double x:Key="A_Double_GammaAdjustStepSDR">0.05</System:Double>
            <System:Double x:Key="A_Double_GammaAdjustStepHDR">0.05</System:Double>
            <local:NumUnitConverter x:Key="A_NumUnitConverter_HDRWhitePointPercent" FractionDigits="0" ShowUnit="False" Scale="{StaticResource A_Double_HDRWhitePoint_MaximumReciprocal}"/>


            <!-- Colors -->
            <Color x:Key="A_Color_BrightnessSquare1">#0F0F0F</Color>
            <Color x:Key="A_Color_BrightnessSquare2">#282828</Color>
            <Color x:Key="A_Color_BrightnessSquare3">#505050</Color>

            <!-- Font Sizes -->
            <System:Double x:Key="A_FontSize_Brightness">152</System:Double>

            <Style x:Key="A_Style_FZTextBlock_Brightness" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Large_Tight}" >
                <Setter Property="FontSize" Value="{StaticResource A_FontSize_Brightness}" />
                <Setter Property="FontFamily" Value="Horizon_A" />
                <Setter Property="Color" Value="Black" />
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPreset_Unlit}" />
            </Style>
            
            <Style x:Key="A_Style_FZTextBlock_Brightness_Instruction" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Large_Tight}" >
                <Setter Property="CapHeight" Value="15" />
                <Setter Property="FontFamily" Value="Horizon_C" />
                <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}" />
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPreset_Unlit}" />
            </Style>

            <local:FZMaterialPresetGlassRoundtangle x:Key="A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll_HighBlur"  BasedOn="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}"
                                                    BlurAmount="High"/>
            
            <Style x:Key="A_Style_FZMaterial_GlassPanel_Pill_VideoOptions" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}">
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll_HighBlur}"/>
                <Setter Property="Color" Value="{StaticResource A_Color_PopupGlass}"/>
            </Style>

            <!-- Brightness Square -->
            <Style x:Key="A_Style_ContentControl_BrightnessSquare" TargetType="ContentControl">
                <Setter Property="local:BindingProxy.A" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <local:FZMaterial x:Name="Mat" Color="#000000">
                                <Grid>
                                    <local:FZMaterial x:Name="ColorBalancePGLogo" ImageSource="/ForzaUI;component/Textures/Data_Bound/CU1/PG_Logo.png" Width="151" Height="149" 
                                                      Preset="{StaticResource A_FZMaterialPreset_Unlit}" Margin="0,-16,0,0"
                                                      HorizontalAlignment="Center" VerticalAlignment="Center" />
                                    <local:FZTextBlock Text="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource A_Style_FZTextBlock_Brightness_Instruction}" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="16" />
                                </Grid>
                            </local:FZMaterial>

                            <ControlTemplate.Triggers>
                                <Trigger  Property="Tag" Value="1">
                                    <Setter TargetName="ColorBalancePGLogo" Property="Color" Value="{StaticResource A_Color_BrightnessSquare1}" />
                                    <Setter TargetName="Mat" Property="Preset" Value="{StaticResource A_FZMaterialPreset_Unlit_Inner_Left}" />
                                </Trigger>
                                <Trigger Property="Tag" Value="2">
                                    <Setter TargetName="ColorBalancePGLogo" Property="Color" Value="{StaticResource A_Color_BrightnessSquare2}" />
                                    <Setter TargetName="Mat" Property="Preset" Value="{StaticResource A_FZMaterialPreset_Unlit}" />
                                </Trigger>
                                <Trigger Property="Tag" Value="3">
                                    <Setter TargetName="ColorBalancePGLogo" Property="Color" Value="{StaticResource A_Color_BrightnessSquare3}" />
                                    <Setter TargetName="Mat" Property="Preset" Value="{StaticResource A_FZMaterialPreset_Unlit_Inner_Right}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Storyboard x:Key="A_Storyboard_FadeOut">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Fader">
                    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0" />
                    <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

            <ControlTemplate x:Key="A_ControlTemplate_DescriptionPanelContent" TargetType="ContentControl">
                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions}" >
                    <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_OptionsDescription}"
                                   AnimationContext="{TemplateBinding Content}"
                                   MaxHeight="58"
                                   VerticalAlignment="Center"
                                   Orientation="Vertical"
                                   Margin="24,16,24,16"/>
                </local:FZMaterial>
            </ControlTemplate>


            <local:TileMenuDataItem x:Key="A_DataItem_Accessibility" Heading="{local:Loc MyProfile.IDS_Accessibility}" Description="{local:Loc MyProfile.IDS_AccessibilityDescription}" />
            <local:TileMenuDataItem x:Key="A_DataItem_Gamma" Heading="{local:Loc MyProfile.IDS_Brightness}" Description="{local:Loc MyProfile.IDS_BrightnessDescription}" />
            <local:TileMenuDataItem x:Key="A_DataItem_Scorpio60HzMode" Description="{local:Loc MyProfile.IDS_Scorpio60HzModeDescription}" />
            <local:TileMenuDataItem x:Key="A_DataItem_HDRWhitePoint" Heading="{local:Loc MyProfile.IDS_HDRWhitePoint}" Description="{local:Loc MyProfile.IDS_HDRWhitePointDescription}" />
            <local:TileMenuDataItem x:Key="A_DataItem_HDRBrightness" Heading="{local:Loc MyProfile.IDS_HDRBrightness}" Description="{local:Loc MyProfile.IDS_HDRBrightnessDescription}" />
            <local:TileMenuDataItem x:Key="A_DataItem_PlayerName" Heading="{local:Loc Main.IDS_VideoOptions_PlayerName}" Description="{local:Loc Main.IDS_VideoOptions_PlayerName_Desc}" />

            <local:TileMenuDataItem x:Key="A_DataItem_Confirm" Heading="{local:Loc HelpButtons.IDS_Accept}" Description="{local:Loc MyProfile.IDS_AcceptOptionsDescription}"/>

            <local:MappingConverter x:Key="A_MappingConvert_Hide_If_HDR_Slider" Default="Visible">
                <local:MappingConverterEntry Key="PART_HDRControl" Value="Collapsed" />
            </local:MappingConverter>

            <Style x:Key="A_Style_FZMaterial_GlassPanel_Pill_VideoOptions_HDR" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions}">
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll_HighBlur}"/>
                <Setter Property="Color" Value="{StaticResource A_Color_PopupGlass}"/>
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="local:BindingProxy.B" Value=""/>
                <Style.Triggers>
                    <!-- We use proxy binding because we cannot look up the list element for usage in datatrigger-->
                    <!--Control visibility if the selected item is not available.-->
                    <DataTrigger Binding="{Binding Path=(local:BindingProxy.B), RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                        <Setter Property="Visibility" Value="{Binding DataSource.IsHDR, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=(local:BindingProxy.B).(Name), RelativeSource={RelativeSource Self}}" Value="PART_HDRControl">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_FZMaterial_GlassPanel_Pill_VideoOptions_SDR" TargetType="{x:Type local:FZMaterial}" BasedOn="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions}">
                <Setter Property="Visibility" Value="{Binding SelectedItem.Name, ElementName=OptionsList, Converter={StaticResource A_MappingConvert_Hide_If_HDR_Slider}, FallbackValue=Collapsed}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding DataSource.IsHDR, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="False">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_ListBoxItem_List_VideoOptions"
                TargetType="{x:Type ListBoxItem}"
                BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=(ListBoxItem.Content).(local:BindingProxy.A), RelativeSource={RelativeSource Self}}" Value="True">
                        <Setter Property="Margin" Value="0"/>
                        <Setter Property="Height" Value="Auto"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <ContentPresenter x:Name="Presenter"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Stretch"/>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_Control_SelectableOption" TargetType="Control">
                <Grid Margin="18,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.55*"/>
                        <ColumnDefinition Width="0.45*"/>
                    </Grid.ColumnDefinitions>
                    <local:FZMaterial x:Name="MouseHitHelper"
                                      Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
                                      Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
                                      Color="#00000000"
                                      Margin="-20,0,0,0"
                                      Grid.ColumnSpan="2"
                                      Focusable="False"/>
                    <local:FZTextBlock  x:Name="ButtonText"
                                        Text="{Binding Tag.Heading, Converter={StaticResource A_StringToUpper}, RelativeSource={RelativeSource TemplatedParent}}"
                                        Style="{StaticResource A_Style_FZTextBlock_SpinnerTitle}"
                                        HorizontalAlignment="Left"/>
                    <local:FZTextBlock  x:Name="ButtonValue"
                                        Text="{Binding Path=(local:BindingProxy.A), Converter={StaticResource A_StringToUpper}, RelativeSource={RelativeSource TemplatedParent}}"
                                        Style="{StaticResource A_Style_FZTextBlock_SpinnerItem}"
                                        Grid.Column="1"
                                        HorizontalAlignment="Center" />
                </Grid>
                <ControlTemplate.Triggers>
                    <DataTrigger Binding="{Binding (Selector.IsSelected), RelativeSource={RelativeSource AncestorType=ListBoxItem}}"
                             Value="True">
                        <Setter TargetName="ButtonText"
                            Property="Color"
                            Value="#ffffffff" />
                        <Setter TargetName="ButtonValue"
                            Property="Color"
                            Value="#ffffffff" />
						<!-- The sliders can register a "SelectedValue" line that isn't cleared when focus moves to the button. Manually clearing the line fixes the VO when the screen first opens. --> 
                        <Setter Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}" Property="local:ScreenReader.ClearLinesOfType" Value="SelectedValue" />
                        <Setter Target="{Binding RelativeSource={RelativeSource AncestorType=ContentPresenter}}" Property="local:ScreenReader.Event" Value="OnChange" />
                    </DataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <local:MappingConverter x:Key="A_MappingConverter_IsIEToTitle">
                <local:MappingConverterEntry Key="False" Value="{local:Loc ScreenTitles.IDS_VideoOptions}" />
                <local:MappingConverterEntry Key="True" Value="{local:Loc ScreenTitles.IDS_InitialGameOptions}" />
            </local:MappingConverter>

            <local:MappingConverter x:Key="A_MappingConverter_IsIEToButtonBarText">
                <local:MappingConverterEntry Key="False" Value="{local:Loc HelpButtons.IDS_Confirm}" />
                <local:MappingConverterEntry Key="True" Value="{local:Loc HelpButtons.IDS_Continue}" />
            </local:MappingConverter>

            <Style x:Key="A_Style_Control_HDR_Notice" TargetType="Control">
                <Setter Property="Height" Value="58"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <Grid>
                                <local:FZMaterial x:Name="Outline" Color="{StaticResource A_Color_White}" Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}"/>
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions}" Margin="2">
                                    <local:FZTextBlock x:Name="HDR_TEXT" 
                                                       Text="{local:Loc MyProfile.IDS_VideoOption_HDR_Enabled}"
                                                       VerticalAlignment="Center" CapHeight="15" 
                                                       HorizontalAlignment="Center" FontFamily="Horizon_C" Color="{StaticResource A_Color_White}"/>
                                </local:FZMaterial>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding IsHDR}" Value="False">
                                    <Setter TargetName="Outline" Property="Opacity" Value="0.5"/>
                                    <Setter TargetName="HDR_TEXT" Property="Opacity" Value="0.5"/>
                                    <Setter TargetName="HDR_TEXT" Property="Text" Value="{local:Loc MyProfile.IDS_VideoOption_HDR_Unavailable}"/>
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_NameCreation_Control" TargetType="Control">
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_Control_SelectableOption}"/>
                <Setter Property="Visibility" Value="{Binding IsIE, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
                <Setter Property="MinHeight" Value="{StaticResource A_Double_TextMenu_Height_Default}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.PCBrightnessSettings}">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_ControllerButtonControl_AButton" TargetType="local:ControllerButtonControl" BasedOn="{StaticResource A_Style_ControllerButtonControl_Default}">
                <Setter Property="Description" Value=""/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding (local:BindingProxy.B).(Name), RelativeSource={RelativeSource Self}}" Value="PART_AcceptButton">
                        <Setter Property="Description" Value="{Binding IsIE, Converter={StaticResource A_MappingConverter_IsIEToButtonBarText}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding (local:BindingProxy.B).(Name), RelativeSource={RelativeSource Self}}" Value="PART_AccessibilityButton">
                        <Setter Property="Description" Value="{local:Loc HelpButtons.IDS_Select}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <System:Double x:Key="A_Double_VideoSetting_Graphic_Height">270</System:Double>

            <local:MappingConverter x:Key="A_Converter_ShowBackgroundBlurInScene" Default="Collapsed">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PCBrightnessSettings}" Value="Visible"/>
            </local:MappingConverter>

            <!--Non PCBrightnessSettings screens can show the options but we hide it in other places -->
            <local:MappingConverter x:Key="A_Converter_SettingsScene_To_Visibility" Default="Visible">
                <local:MappingConverterEntry Key="{x:Static local:SceneEntryEnum.PCBrightnessSettings}" Value="Collapsed"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_VideoOptions_Listbox_List" TargetType="{x:Type local:CommonListBox}" BasedOn="{StaticResource A_Style_ListBox_List_Default}">
                <Setter Property="Height" Value="auto"/>
                <Setter Property="ItemContainerStyle" Value="{StaticResource A_Style_ListBoxItem_List_VideoOptions}"/>
                <Style.Triggers>
                    <!--There is a bug where the list box incorrectly evaluates the size of a list and can think there is more size than there really is when used as a popup. 
                    This just helps to restrict the impact of the bug by limiting the max height so the popup can never severly gain too much height. 106 is enough size for 2 plus seperation, list items-->
                    <DataTrigger Binding="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" Value="{x:Static local:SceneEntryEnum.PCBrightnessSettings}">
                        <Setter Property="MaxHeight" Value="106"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <local:MultiConverter x:Key="A_Converter_OpacityBagValueToDisplayValue">
                <local:MultiConverterEntry>
                    <local:MultiConverterEntry.Converter>
                        <local:LinearTransformConverter Scale="100" />
                    </local:MultiConverterEntry.Converter>
                </local:MultiConverterEntry>
                <local:MultiConverterEntry Converter="{StaticResource A_NumUnitConverter_NoUnit_0dp}" />
            </local:MultiConverter>

            <Style x:Key="A_Style_SpinnerControl_Default_VideoOption"
                   BasedOn="{StaticResource A_Style_SpinnerControl_Default_InItemsList}"
                   TargetType="local:SpinnerControl">
                <Setter Property="local:AccumulateSelfOnParent.SortOrder"
                        Value="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"/>
                <Setter Property="local:FindSelfIndexInCollection.Collection"
                        Value="{Binding (local:AccumulateSelfOnParent.Output), ElementName=OptionsList}"/>
                <Setter Property="local:ScreenReader.SelectedNumber"
                        Value="{Binding (local:FindSelfIndexInCollection.Index), RelativeSource={RelativeSource Self}, Converter={StaticResource A_IndexToNumberConverter}, FallbackValue=0}"/>
                <Setter Property="local:ScreenReader.SelectedCount"
                        Value="{Binding (local:AccumulateSelfOnParent.Output).Count, ElementName=OptionsList, FallbackValue=0}"/>
                <Style.Triggers>
                    <Trigger Property="Visibility" Value="Visible">
                        <Setter Property="local:AccumulateSelfOnParent.ParentName" Value="OptionsList"/>
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Slider_Options_Default_VideoOption"
                   BasedOn="{StaticResource A_Style_Slider_Options_InItemsList}"
                   TargetType="Slider">
                <Setter Property="local:AccumulateSelfOnParent.SortOrder"
                        Value="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"/>
                <Setter Property="local:FindSelfIndexInCollection.Collection"
                        Value="{Binding (local:AccumulateSelfOnParent.Output), ElementName=OptionsList}"/>
                <Setter Property="local:ScreenReader.SelectedNumber"
                        Value="{Binding (local:FindSelfIndexInCollection.Index), RelativeSource={RelativeSource Self}, Converter={StaticResource A_IndexToNumberConverter}, FallbackValue=0}"/>
                <Setter Property="local:ScreenReader.SelectedCount"
                        Value="{Binding (local:AccumulateSelfOnParent.Output).Count, ElementName=OptionsList, FallbackValue=0}"/>
                <Style.Triggers>
                    <Trigger Property="Visibility" Value="Visible">
                        <Setter Property="local:AccumulateSelfOnParent.ParentName" Value="OptionsList"/>
                    </Trigger>                    
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Default_VideoOptions_Button" TargetType="local:FZButton" BasedOn="{StaticResource A_Style_Button_EmptyButton}">
                <Setter Property="Focusable" Value="True"/>
                <Setter Property="local:FocusOnMouseOverBehaviour.Self" Value="True"/>
                <Setter Property="MinHeight" Value="{StaticResource A_Double_TextMenu_Height_Default}"/>
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_Control_SelectableOption}"/>
                <Setter Property="local:AccumulateSelfOnParent.SortOrder"
                        Value="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"/>
                <Setter Property="local:FindSelfIndexInCollection.Collection"
                        Value="{Binding (local:AccumulateSelfOnParent.Output), ElementName=OptionsList}"/>
                <Setter Property="local:ScreenReader.SelectedNumber"
                        Value="{Binding (local:FindSelfIndexInCollection.Index), RelativeSource={RelativeSource Self}, Converter={StaticResource A_IndexToNumberConverter}, FallbackValue=0}"/>
                <Setter Property="local:ScreenReader.SelectedCount"
                        Value="{Binding (local:AccumulateSelfOnParent.Output).Count, ElementName=OptionsList, FallbackValue=0}"/>
                <Setter Property="local:ScreenReader.LineType" Value="SelectedItem" />
                <Setter Property="local:ScreenReader.Event" Value="OnFocus" />
                <Setter Property="local:ScreenReader.Line" Value="{Binding Tag.Heading, RelativeSource={RelativeSource Self}}" />
                <Setter Property="local:ScreenReader.ControlType" Value="Button" />
                <Style.Triggers>
                    <Trigger Property="Visibility" Value="Visible">
                        <Setter Property="local:AccumulateSelfOnParent.ParentName" Value="OptionsList"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
            
        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}" 
                          Visibility="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_Converter_ShowBackgroundBlurInScene}, FallbackValue=Collapsed}"/>

        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}" />
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="HelpPanel" Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="A" Style="{StaticResource A_Style_ControllerButtonControl_AButton}" local:BindingProxy.B="{Binding SelectedItem, ElementName=OptionsList, FallbackValue={x:Null}}"/>
                <local:ControllerButtonControl Button="B" Description="{local:Loc HelpButtons.IDS_Back}" />
                <local:ControllerButtonControl Button="X" Description="{local:Loc HelpButtons.IDS_LanguageSelect}" Visibility="{Binding ShowLanguageSelect, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                <local:ControllerButtonControl Button="Y" Description="{local:Loc HelpButtons.IDS_ResetDefault}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}" SnapsToDevicePixels="True" UseLayoutRounding="True" >
            <Grid x:Name="LayoutRoot" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Grid Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}" Focusable="False" >
                    <StackPanel Name="BasicOptions" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}" >
                        <ContentControl Tag="{local:Loc ScreenTitles.IDS_MyProfile}" 
                                        Content="{Binding IsIE, Converter={StaticResource A_MappingConverter_IsIEToTitle}}" 
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Options.png"
                                        Focusable="False" 
                                        HorizontalAlignment="Left" />

                        <DockPanel HorizontalAlignment="Center">
                            <DockPanel Width="835">
                                <Grid DockPanel.Dock="Top">
                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions_SDR}">
                                        <StackPanel Orientation="Vertical">
                                            <UniformGrid Margin="5" Columns="3" Height="{StaticResource A_Double_VideoSetting_Graphic_Height}">
                                                <ContentControl Tag="1" Grid.Column="0" local:BindingProxy.A="{local:Loc MyProfile.IDS_BrightnessTile_BarelyVisible}"  Style="{StaticResource A_Style_ContentControl_BrightnessSquare}" />
                                                <ContentControl Tag="2" Grid.Column="1" local:BindingProxy.A="{local:Loc MyProfile.IDS_BrightnessTile_Visible}" Style="{StaticResource A_Style_ContentControl_BrightnessSquare}" />
                                                <ContentControl Tag="3" Grid.Column="2" local:BindingProxy.A="{local:Loc MyProfile.IDS_BrightnessTile_EasilyVisible}" Style="{StaticResource A_Style_ContentControl_BrightnessSquare}" />
                                            </UniformGrid>

                                            <Control Style="{StaticResource A_Style_Control_HDR_Notice}" Margin="5,0,5,6"/>
                                        </StackPanel>
                                    </local:FZMaterial>

                                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill_VideoOptions_HDR}"
                                            local:BindingProxy.A="True"
                                            local:BindingProxy.B="{Binding SelectedItem, ElementName=OptionsList, FallbackValue={x:Null}}">
                                        <StackPanel Orientation="Vertical">
                                            <Grid>
                                                <local:FZMaterial Margin="5"
                                                                    Height="{StaticResource A_Double_VideoSetting_Graphic_Height}"
                                                                    Color="#FFFFFFFF">
                                                    <local:FZMaterial.Preset>
                                                        <local:FZMaterialPresetHDR BrightnessScale="10000" Unlit="True"
                                                            CornerRadius="{StaticResource A_CornerRadius_Inner_All}"/>
                                                    </local:FZMaterial.Preset>
                                                    <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/HDR_Forza_Logo.png"
                                                                        Height="210"
                                                                        Width="330"
                                                                        HorizontalAlignment="Center"
                                                                        VerticalAlignment="Center"
                                                                        Color="#FFFFFFFF"
                                                                        Margin="0,10,0,0">
                                                        <local:FZMaterial.Preset>
                                                            <local:FZMaterialPresetHDR BrightnessScale="{Binding HDRLogoBrightness}" Unlit="True"/>
                                                        </local:FZMaterial.Preset>
                                                    </local:FZMaterial>
                                                </local:FZMaterial>

                                                <!--We can not show text over the HDR Whitepoint display as the output is too intense for the alpha in the fonts to alias the text;
                                                    to remedy this we place it on a isolated material not being manipulated by HDR Settings-->
                                                <local:FZMaterial Margin="16" 
                                                                  HorizontalAlignment="Center" VerticalAlignment="Bottom"
                                                                  Color="{StaticResource A_Color_White}" Style="{StaticResource A_Style_FZMaterial_FlatPanel_HeaderPill}">
                                                    <local:FZTextBlock Text="{Binding Source={local:Loc MyProfile.IDS_VideoOption_HDR_Slider_Notification}, Converter={StaticResource A_StringToUpper}}"
                                                                       CapHeight="15" Color="{StaticResource A_Color_Tile_Text}" FontFamily="Horizon_C" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6" />
                                                </local:FZMaterial>
                                            </Grid>

                                            <Control Style="{StaticResource A_Style_Control_HDR_Notice}" Margin="5,0,5,6"/>
                                        </StackPanel>
                                    </local:FZMaterial>
                                </Grid>

                                <ContentControl DockPanel.Dock="Top" Margin="0,6,0,0"
                                    Content="{Binding Tag.Description}"
                                    DataContext="{Binding SelectedItem, ElementName=OptionsList}"
                                    Height="85" IsHitTestVisible="False"
                                    Template="{StaticResource A_ControlTemplate_DescriptionPanelContent}"/>

                                <Grid Margin="0,6,0,3">
                                    <local:CommonListBox x:Name="OptionsList"
                                                         Style="{StaticResource A_Style_VideoOptions_Listbox_List}"
                                                         SelectedItem="{Binding SelectedItem}"
                                                         local:AncestorPropertySetter.Property="SelectedItem"
                                                         local:AncestorPropertySetter.Type="{x:Type local:VideoOptions}"
                                                         local:AncestorPropertySetter.Value="{Binding SelectedItem, RelativeSource={RelativeSource Self}}">
                                        <Slider Value="{Binding Gamma}" 
                                                Tag="{StaticResource A_DataItem_Gamma}" 
                                                Style="{StaticResource A_Style_Slider_Options_Default_VideoOption}" 
                                                SmallChange="{StaticResource A_Double_GammaAdjustStepSDR}"
                                                x:Name="FirstItem" 
                                                Visibility="{Binding DataSource.IsHDR, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}, FallbackValue=Visible}" />

                                        <Slider Value="{Binding HDRWhitePoint}"
                                                x:Name="PART_HDRControl"
                                                Tag="{StaticResource A_DataItem_HDRWhitePoint}"
                                                Style="{StaticResource A_Style_Slider_Options_Default_VideoOption}"
                                                Visibility="{Binding DataSource.IsHDR, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                                Minimum="{StaticResource A_Double_HDRWhitePoint_Minimum}"
                                                Maximum="{StaticResource A_Double_HDRWhitePoint_Maximum}"
                                                SmallChange="{StaticResource A_Double_HDRWhitePoint_SmallChange}"
                                                local:BindingProxy.B="{Binding Value, RelativeSource={RelativeSource Self}, ConverterParameter=fracpercentage, Converter={StaticResource A_NumUnitConverter_HDRWhitePointPercent}}"
                                                local:BindingProxy.AlwaysValidNumeric="90" />

                                        <Slider Value="{Binding HDRBrightness}"
                                                Tag="{StaticResource A_DataItem_HDRBrightness}"
                                                Style="{StaticResource A_Style_Slider_Options_Default_VideoOption}"
                                                SmallChange="{StaticResource A_Double_GammaAdjustStepHDR}"
                                                Visibility="{Binding DataSource.IsHDR, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                                local:BindingProxy.AlwaysValidNumeric="90" />

                                        <local:SpinnerControl Tag="{StaticResource A_DataItem_Scorpio60HzMode}" Style="{StaticResource A_Style_SpinnerControl_Default_VideoOption}" Label="{local:Loc MyProfile.IDS_Scorpio60HzMode}" SelectedIndex="{Binding Scorpio60HzMode}" ItemsSource="{Binding Scorpio60HzModeOptions}" 
                                                              Visibility="{Binding DataSource.ShowScorpio60HzMode, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />

                                        <local:FZButton x:Name="PART_AccessibilityButton"
                                                        Tag="{StaticResource A_DataItem_Accessibility}"
                                                        Style="{StaticResource A_Style_Default_VideoOptions_Button}"
                                                        Command="{Binding AccessibilityCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                                        Visibility="{Binding SceneEnum, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_Converter_SettingsScene_To_Visibility}}"/>

                                        <local:FZButton x:Name="PART_AcceptButton"
                                                        Tag="{StaticResource A_DataItem_Confirm}"
                                                        Style="{StaticResource A_Style_Default_VideoOptions_Button}"
                                                        Command="{Binding AcceptCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}" />
                                    </local:CommonListBox>
                                </Grid>
                            </DockPanel>
                        </DockPanel>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>

        <local:FZMaterial x:Name="Fader" Color="Black" Opacity="0" IsHitTestVisible="False" />
    </Grid>
</Page>
