<Page 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 IsHitTestVisible="False" Height="48">
                    <StackPanel Orientation="Horizontal">
                        <local:FZTextBlock Text="{Binding FormattedClubTag}"
                                           Style="{StaticResource A_Style_FZTextBlock_OptionText}"
                                           FontFamily="Horizon_C"
                                           CapHeight="15"/>
                        <local:FZTextBlock Text="{Binding FormattedGamertag}"
                                           FontFamily="Horizon_C"
                                           Style="{StaticResource A_Style_FZTextBlock_OptionText}"
                                           CapHeight="15" Margin="-10,0,0,0"/>
                </StackPanel>
              </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"
                                      Margin="-18,0"
                                      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"
                                      KeepSelectionOnScreen="True">
                        <VirtualizingStackPanel Orientation="Vertical"
                                                Margin="18,0"
                                                IsItemsHost="True"
                                                VirtualizingStackPanel.VirtualizationMode="Recycling"
                                                Focusable="False" />
                    </local:FZScrollViewer>
                </Border>
            </ControlTemplate>


        </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="DefaultHelpPanel"
                                local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                                local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                                local:ControllerButtonPanel.XDescription="{local:Loc HelpButtons.IDS_ShowGamercard}"
                                Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
            </ContentControl>
        </Grid>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              Focusable="False">
            <StackPanel x:Name="MainContent"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Width="600"
                    Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                <ContentControl Content="{Binding Title, Converter={StaticResource A_StringToUpper}}"
                                Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"/>
                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}"
                                Tag="/ForzaUI;component/Textures/Anthem/Icons/Titles/PopupFollowedPlayers.png">
                    <Grid Width="550">
                        <local:CommonListBox x:Name="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}"
                                             VerticalAlignment="Top"
                                             MaxHeight="663"
                                             Template="{StaticResource A_Template_ListBox_FollowPlayers}">
                        </local:CommonListBox>
                    </Grid>
                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
