<FollowedPlayers x:Class="ForzaUI.A_FollowedPlayers"
      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"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      xmlns:System="clr-namespace:System;assembly=mscorlib">
    <Page.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="A_DataTemplate_TextMenu_FollowedPlayers">
                <Grid HorizontalAlignment="Center" IsHitTestVisible="False" Height="48">
                    <local:FZTextBlock Text="{Binding FormattedGamertag, Converter={StaticResource A_StringToUpper}}"
                                       Style="{StaticResource A_Style_FZTextBlock_OptionText}"
                                       Margin="-10,0,0,0" />
                </Grid>
            </DataTemplate>

            <ControlTemplate TargetType="{x:Type ListBox}"
                             x:Key="A_Template_ListBox_FollowPlayers">
                <Border Background="{x:Null}">
                    <local:FZScrollViewer Template="{StaticResource A_ControlTemplate_ScrollViewer_Popup_ExternalRightPosition}"
                                        CanContentScroll="True"
                                        HorizontalScrollBarVisibility="Disabled"
                                        VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}"
                                        local:FZScrollViewer.IsAtTop="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:FZScrollViewer.IsAtTop), Mode=OneWayToSource}"
                                        local:FZScrollViewer.IsAtBottom="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:FZScrollViewer.IsAtBottom), Mode=OneWayToSource}"
                                        Focusable="False"
                                        DragMovementMultiplier="0.03"
                                        KeepSelectionOnScreen="True">
                        <VirtualizingStackPanel Orientation="Vertical"
                                            IsItemsHost="True"
                                            VirtualizingStackPanel.VirtualizationMode="Recycling"
                                            Focusable="False" />
                    </local:FZScrollViewer>
                </Border>
            </ControlTemplate>

            <Style x:Key="A_Style_ContentControl_PlayerListButtonBar"
                   TargetType="ContentControl"
                   BasedOn="{StaticResource A_Style_ContentControl_DefaultButtonBar}">
                <Setter Property="local:ControllerButtonPanel.XDescription" Value="{local:Loc HelpButtons.IDS_ShowGamercard}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ShouldShowContributorGamercard}" Value="False">
                        <Setter Property="local:ControllerButtonPanel.XDescription" Value="" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

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

    <Grid>
        <Grid>
            <!-- Background Blur -->
            <local:FZMaterialGlassCapture />
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"
                                MinWidth="{Binding ActualWidth, ElementName=MainContent}"
                                MinHeight="{Binding ActualHeight, ElementName=MainContent}"/>

            <!-- Help Button Bar -->
            <ContentControl x:Name="BottomBar"
                            Style="{StaticResource A_Style_ButtonBar}">
                <ContentControl x:Name="PART_DefaultHelpPanel"
                                local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                                local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                                Style="{StaticResource A_Style_ContentControl_PlayerListButtonBar}" />
            </ContentControl>
        </Grid>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              Focusable="False">
            <StackPanel x:Name="MainContent"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                <ContentControl Content="{Binding Title}"
                                Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"/>
                <local:CommonListBox x:Name="PART_Menu"
                            Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                            ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Default}"
                            ItemTemplate="{StaticResource A_DataTemplate_TextMenu_FollowedPlayers}"
                            ItemsSource="{Binding Collection}"
                            SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
                            FocusOnPageFocusGained.SelectorSelectedItem="True"
                            VerticalAlignment="Top"
                            MaxHeight="676"
                            Margin="0,-2,0,0"
                            Template="{StaticResource A_Template_ListBox_FollowPlayers}"
                            local:ScreenReader.Line="{Binding SelectedItem.Text, RelativeSource={RelativeSource Self}}"
                            local:ScreenReader.LineType="SelectedItem"
                            local:ScreenReader.Event="OnChange"
                            local:ScreenReader.SelectedNumber="{Binding SelectedItem.Index, RelativeSource={RelativeSource Self}, Converter={StaticResource A_IndexToNumberConverter}, FallbackValue=-1}"
                            local:ScreenReader.SelectedCount="{Binding Collection.Count}">
                </local:CommonListBox>
            </StackPanel>
        </Grid>
    </Grid>
</FollowedPlayers>
