<InputOptions 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_InputOptions"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPreset_RequiredMappingBackground"
                                           BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
                                           CornerRadius="20" />

        <Style x:Key="A_Style_Control_RequiredMappingIcon"
               TargetType="Control">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Control">
                        <local:FZMaterial x:Name="Breadcrumb"
                                          HorizontalAlignment="Right"
                                          VerticalAlignment="Center"
                                          Width="40"
                                          Height="40"
                                          Color="{StaticResource H_Color_Primary_Yellow}"
                                          Preset="{StaticResource A_FZMaterialPreset_RequiredMappingBackground}">
                            <local:FZTextBlock Text="!"
                                               Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                               Color="{StaticResource H_Color_Primary_Black}"
                                               FontSize="30"
                                               Margin="0,0,0,0"
                                               HorizontalAlignment="Center"
                                               VerticalAlignment="Center" />
                        </local:FZMaterial>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_Control_RequiredMappingIcon_Perm"
               TargetType="Control"
               BasedOn="{StaticResource A_Style_Control_RequiredMappingIcon}">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsRequiredForController}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}" Value="True" />
                        <!--Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" /-->
                        <Condition Binding="{Binding IsRemapped}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsRequiredForKeyboard}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsKeyboardDataSource, ElementName=PART_GroupList}" Value="True"/>
                        <!--Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" /-->
                        <Condition Binding="{Binding IsRemapped}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsRequiredForWheel}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsWheelDataSource, ElementName=PART_GroupList}" Value="True" />
                        <!--Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" /-->
                        <Condition Binding="{Binding IsRemapped}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_StackPanel_ShowRemappingRequirement"
               TargetType="StackPanel">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForController, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}" Value="True" />
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                        <Setter Property="Visibility"
                                Value="Visible" />
                </MultiDataTrigger>

                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForKeyboard, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsKeyboardDataSource, ElementName=PART_GroupList}" Value="True"/>
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>

                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForWheel, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsWheelDataSource, ElementName=PART_GroupList}" Value="True" />
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                        <Condition Binding="{Binding SelectedItem.DataSource.Options.CurrentItem.SelectedItem.IsDefaultProfile, ElementName=PART_GroupList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>


        <Style x:Key="A_Style_SpinnerControl_Default_InItemsList_SelfFocusing"
            BasedOn="{StaticResource A_Style_SpinnerControl_Default}"
            TargetType="local:SpinnerControl">
            <Style.Resources>
                <Thickness x:Key="A_Thickness_SpinnerMargin_Dynamic">16,0</Thickness>
            </Style.Resources>
            <Setter Property="Height"
                    Value="{StaticResource A_Double_TextMenu_Height_Default}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource AncestorType=ListBoxItem}, FallbackValue=False}" Value="True">
                    <Setter Property="FocusSelf.WhenTrue" Value="True"/>
                </DataTrigger>
                <!-- this second trigger is needed when we are in lists in which the ancestor listbox item also necessarily uses FocusSelf.WhenTrue to select itself in some scenarios.
                Depending on the timing, it can prevent focus from ending up on the contentpresenter or spinner inside, or steal it.
                this trigger should work to always bring focus back to our spinner when needed. (Forte Bug 4351749: [UI] [Menus] No text when clicking over to 'Wheel' in 'Change Input Mapping' menu).
                One of the reasons that these two triggers here work is that they can result in FocusSelf.WhenTrue on the spinner going back to false when the spinner gains focus, which means when the ancestor/templatedparent
                steals focus back, it will change FocusSelf.WhenTrue to true so it can execute again (if it had stayed true the whole time, it would not execute again)
                
                keeping this fix local to the InputOptions because its late in shutdown and we haven't had reported problems elsewhere-->
                <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource TemplatedParent}, FallbackValue=False}" Value="True">
                    <Setter Property="FocusSelf.WhenTrue" Value="True"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <Style x:Key="A_Style_InputOptions_PresetSpinner"
               BasedOn="{StaticResource A_Style_SpinnerControl_Default_InItemsList_SelfFocusing}"
               TargetType="local:SpinnerControl">
            <Setter Property="Label"
                    Value="{local:Loc MyProfile.IDS_InputPreset}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}"
                             Value="True">
                    <Setter Property="Label"
                            Value="{local:Loc MyProfile.IDS_Option_Layout}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding SelectedItem.DataSource.IsWheelDataSource, ElementName=PART_GroupList}"
                             Value="True">
                    <Setter Property="Label"
                            Value="{local:Loc MyProfile.IDS_Option_Layout}" />
                </DataTrigger>
                <EventTrigger RoutedEvent="PreviewNextSel">
                    <local:CommandAction CommandPropertyPath="ProfileSpinnerPreviewNextSel" AncestorType="Page" />
                </EventTrigger>
                <EventTrigger RoutedEvent="PreviewPrevSel">
                    <local:CommandAction CommandPropertyPath="ProfileSpinnerPreviewPrevSel" AncestorType="Page" />
                </EventTrigger>
                <EventTrigger RoutedEvent="LostKeyboardFocus">
                    <local:CommandAction CommandPropertyPath="ProfileSpinnerKeyboardFocusLost" AncestorType="Page" />
                </EventTrigger>
                <EventTrigger RoutedEvent="GotKeyboardFocus">
                    <local:CommandAction CommandPropertyPath="ProfileSpinnerKeyboardFocusGained" AncestorType="Page" />
                </EventTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_InputOptions_ToggleSpinner"
               BasedOn="{StaticResource A_Style_SpinnerControl_Default_InItemsList_SelfFocusing}"
               TargetType="local:SpinnerControl">
            <Setter Property="Label"
                    Value="{Binding Name}" />
            <Setter Property="SelectedIndex"
                    Value="{Binding Selection}" />
        </Style>

        <DataTemplate DataType="{x:Type local:InputProfilesList}">
            <local:SpinnerControl Style="{StaticResource A_Style_InputOptions_PresetSpinner}"
                                  SelectedItem="{Binding SelectedItem}"
                                  ItemsSource="{Binding Profiles}"
                                  Focusable="True"
                                  IsLocked="{Binding SelectedItem.DataSource.IsLockedToCurrentProfile, ElementName=PART_GroupList}"/>
        </DataTemplate>

        <DataTemplate DataType="{x:Type local:PCInputCombineInputsToggle}">
            <local:SpinnerControl Style="{StaticResource A_Style_InputOptions_ToggleSpinner}"
                                  ItemsSource="{Binding OnOffOptions}"
                                  Focusable="True" />
        </DataTemplate>

        <Style x:Key="A_Style_ControllerButton_Unbound" TargetType="ControllerButtonControl"
            BasedOn="{StaticResource {x:Type ControllerButtonControl}}">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Visibility" Value="{Binding IsRemapped, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"/>
            <Setter Property="Margin" Value="0,0,8,0"/>
            <Setter Property="Button" Value="Invalid" />
            <Setter Property="AllowMouseClick" Value="false"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}" Value="True">
                    <Setter Property="ForceInputDeviceType" Value="{Static XAMLInputDeviceType.GamepadWheel}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding SelectedItem.DataSource.IsKeyboardDataSource, ElementName=PART_GroupList}" Value="True">
                    <Setter Property="ForceInputDeviceType" Value="{Static XAMLInputDeviceType.KeyboardAndMouse}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding SelectedItem.DataSource.IsWheelDataSource, ElementName=PART_GroupList}" Value="True">
                    <Setter Property="ForceInputDeviceType" Value="{Static XAMLInputDeviceType.RawGameController}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <DataTemplate DataType="{x:Type local:CPInputCommand}">
            <local:FZButton x:Name="RemapButton"
                            Style="{StaticResource A_Style_Button_EmptyButton}"
                            Command="{Binding SelectedItem.DataSource.RemapInput, ElementName=PART_GroupList}"
                            CommandParameter="{Binding DataContext, RelativeSource={RelativeSource Self}}"
                            FocusSelf.WhenTrue="{Binding IsKeyboardFocused, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, FallbackValue=False}"
                            ClickMode="Release"
                            Height="{StaticResource A_Double_TextMenu_Height_Default}">
                <local:FZMaterial x:Name="MouseHitHelper" Color="#00FFFFFF">
                    <Grid>
                        <Viewbox Width="25"
                                 Height="25"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,11,0">
                            <Control x:Name="Breadcrumb"
                                     Style="{StaticResource A_Style_Control_RequiredMappingIcon_Perm}" />
                        </Viewbox>
                        <Grid Margin="16,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.535*"/>
                                <ColumnDefinition Width="0.465*"/>
                            </Grid.ColumnDefinitions>
                            <local:FZTextBlock x:Name="RemapButtonNameText"
                                               Text="{Binding Name}"
                                               Style="{StaticResource A_Style_FZTextBlock_SpinnerTitle}"
                                               HorizontalAlignment="Left" 
                                               local:ScreenReader.Event="OnChange"
                                               local:ScreenReader.ControlType="Button"
                                               local:ScreenReader.LineType="SelectedItem"
                                               local:ScreenReader.SelectedNumber="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Converter={StaticResource A_IndexToNumberConverter}}"
                                               local:ScreenReader.SelectedCount="{Binding Items.Count, RelativeSource={RelativeSource AncestorType={x:Type Selector}}}"/>
                            <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center">
                                <ControllerButtonControl Style="{StaticResource A_Style_ControllerButton_Unbound}"
                                    UseLargeIcon="True"
                                    HideBackground="True"
                                    Tag="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}"
                                    MinHeight="32"
                                    MinWidth="32"
                                    Opacity="1" />
                                <local:FZTextBlock x:Name="RemapButtonValueText"
                                                   Text="{Binding Value}"
                                                   Style="{StaticResource A_Style_FZTextBlock_SpinnerItem}"
                                                   local:ScreenReader.Event="OnChange"
                                                   local:ScreenReader.LineType="SelectedValue" />
                            </StackPanel>
                        </Grid>
                    </Grid>
                </local:FZMaterial>
            </local:FZButton>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding IsKeyboardFocusWithin, ElementName=RemapButton}"
                             Value="True">
                    <Setter TargetName="RemapButtonNameText" Property="Color" Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                    <Setter TargetName="RemapButtonValueText" Property="Color" Value="{StaticResource A_Color_TextMenu_Text_Highlighted}" />
                    <Setter TargetName="RemapButtonNameText" Property="local:ScreenReader.Line" Value="{Binding Name}" />
                    <Setter TargetName="RemapButtonValueText" Property="local:ScreenReader.Line" Value="{Binding ValueScreenReader}" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>

        <Style x:Key="A_Style_FZTextBlock_RequiredMapping"
               TargetType="local:FZTextBlock"
               BasedOn="{StaticResource A_Style_FZTextBlock_DescriptionBlockBody}">
            <Setter Property="Visibility"
                    Value="Collapsed" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForController, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsControllerDataSource, ElementName=PART_GroupList}" Value="True" />
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Text"
                            Value="{local:Loc MyProfile.IDS_ControllerMappingRequired}" />
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForKeyboard, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsKeyboardDataSource, ElementName=PART_GroupList}" Value="True"/>
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Text"
                            Value="{local:Loc MyProfile.IDS_KeyboardMappingRequired}" />
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding SelectedItem.IsRequiredForWheel, ElementName=PART_OptionsList}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.DataSource.IsWheelDataSource, ElementName=PART_GroupList}" Value="True" />
                        <Condition Binding="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}}" Value="True" />
                        <Condition Binding="{Binding SelectedItem.IsRemapped, ElementName=PART_OptionsList}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Text"
                            Value="{local:Loc MyProfile.IDS_WheelMappingRequired}" />
                    <Setter Property="Visibility"
                            Value="Visible" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style
            BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_Gaps}"
            TargetType="{Type ListBoxItem}"
            x:Key="A_Style_ListBoxItem_InputOptions">
            <Setter
                Property="Template"
                Value="{StaticResource A_ControlTemplate_TextMenu_Default}" />
            <Setter
                Property="FocusSelf.WhenTrue"
                Value="{Binding (Selector.IsSelected), RelativeSource={RelativeSource Self}}" />
            <Setter
                Property="local:FocusOnMouseOverBehaviour.Self"
                Value="True" />
            <Setter
                Property="Margin"
                Value="0,0,0,3" />
        </Style>
    </Page.Resources>

    <Grid>
        <!-- Background Blur -->
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>


        <local:PlayerBarControl x:Name="TopBar" Style="{StaticResource A_Style_PlayerBarControl}"
            Visibility="{Binding IsInPauseFlow, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
        <PageInputHandler Button="X"
            Command="{Binding ClearCommand}"
            x:Name="x_button" />
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="PART_HelpPanel"
                                         Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="A"
                                               Description="{local:Loc HelpButtons.IDS_Select}"
                                               Visibility="{Binding ShouldShowRemapButton, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                <local:ControllerButtonControl Button="B"
                                               Description="{local:Loc HelpButtons.IDS_Back}" />
                <local:ControllerButtonControl Button="{Binding Button, ElementName=x_button}"
                                               Description="{local:Loc InputUINames.IDS_Unbind}"
                                               Visibility="{Binding Command.Enabled, ElementName=x_button, FallbackValue=Collapsed, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                <local:ControllerButtonControl Button="Start"
                                               Description="{local:Loc HelpButtons.IDS_Save}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}"
                SnapsToDevicePixels="True"
                UseLayoutRounding="True" >
            <Grid x:Name="PART_LayoutRoot" Margin="0,40,0,0">
                <StackPanel Name="BasicOptions" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Center" >
                    <StackPanel Orientation="Horizontal" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                        <ContentControl Tag="{local:Loc ScreenTitles.IDS_MyProfile}" 
                                        Content="{local:Loc ScreenTitles.IDS_ControllerOptions}" 
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}" 
                                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Options.png" 
                                        Focusable="False" />
                    </StackPanel>
                    
                    <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}" >
                        <FZTabButtonsSelector
                            DockPanel.Dock="Top"
                            x:Name="PART_GroupList"
                            Style="{StaticResource H_Style_TabBar}"
                            ItemsSource="{Binding Categories, RelativeSource={RelativeSource AncestorType=Page}}"
                            SelectedIndex="{Binding SelectedGroupIndex}"
                            IsLocked="{Binding ChangesMadeInThisTab, RelativeSource={RelativeSource AncestorType=Page}}"
                            HorizontalAlignment="Left" />
                        <Grid DockPanel.Dock="Right"
                              Height="660">
                            <ContentControl Template="{StaticResource A_ControlTemplate_DescriptionPanel}"
                                            DataContext="{Binding SelectedItem, ElementName=PART_OptionsList}"
                                            Visibility="Visible"
                                            Content="{Binding Description}"
                                            Margin="6,0,0,0"
                                            Width="412" />
                            <StackPanel Style="{StaticResource A_Style_StackPanel_ShowRemappingRequirement}"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Bottom"
                                        Margin="35,0,0,25"
                                        Orientation="Horizontal">
                                <Control Style="{StaticResource A_Style_Control_RequiredMappingIcon}" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_RequiredMapping}"
                                                   Color="{StaticResource A_Color_Body_Text}"
                                                   Margin="10,0,0,2"
                                                   VerticalAlignment="Center" />
                            </StackPanel>
                        </Grid>
                        <StackPanel Orientation="Horizontal"
                                   local:UIPageTransitionManager.TransitionIndex="0"
                                   DockPanel.Dock="Left"
                                   Height="660"
                                   DataContext="{Binding SelectedItem.DataSource, ElementName=PART_GroupList}">
                            <local:WrapListBox x:Name="PART_OptionsList"
                                                 Template="{StaticResource H_ControlTemplate_TextMenu_Default}" 
                                                 ItemContainerStyle="{StaticResource A_Style_ListBoxItem_InputOptions}"
                                                 ScrollOrientation="Vertical"
                                                 Width="834"
                                                 ItemWidth="834"
                                                 ItemHeight="51"
                                                 Focusable="False"
                                                 FocusOnPageFocusGained.SelectorSelectedItem="True"
                                                 AllowMouseWheelScrolling="False"
                                                 ItemsSource="{Binding Options}"
                                                 SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType=Page}}" >
                                <WrapListBox.Resources>
                                    <Thickness x:Key="A_Margin_VirtualizingWrapPanel">0,0,0,-3</Thickness>
                                </WrapListBox.Resources>
                            </local:WrapListBox>
                            <Decorator Width="10"/>
                            <ScrollBar
                                Style="{StaticResource A_Style_ScrollBar_Default}"
                                Minimum="{Binding ScrollWindowMin, ElementName=PART_OptionsList}"
                                Maximum="{Binding ScrollWindowMax, ElementName=PART_OptionsList}"
                                Value="{Binding ScrollWindowValue, ElementName=PART_OptionsList, Mode=TwoWay}"
                                ViewportSize="{Binding ScrollWindowSize, ElementName=PART_OptionsList}" />
                        </StackPanel>
                    </DockPanel>
                </StackPanel>
            </Grid>
        </Border>

        <Decorator Style="{Binding A_Style_FrameworkElement_LayoutRoot}">
            <local:FZTextBlock Color="#FF888888" FontSize="15" Text="{Binding TestPackageMessage}" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
        </Decorator>
    </Grid>
</InputOptions>
