<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.Scenes.Anthem.A_SeriesChampionsLeaderboardsPopup"
      mc:Ignorable="d"
	  Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"
      >
    <Page.Resources>
        <ResourceDictionary>
            <AutoScrollSettings x:Key="A_AutoScrollSettings_MoreInfoText"
                                ScrollSeparation="50"
                                InitialPause="0:0:0.5"
                                Speed="40"
                                ScrollOrientation="Vertical"/>
            
            <Style
                x:Key="A_Style_Control_EmptyItemStyle"
                TargetType="Control">
                <Setter
                    Property="Focusable"
                    Value="False"/>
                <Setter
                    Property="Template">
                    <Setter.Value>
                        <ControlTemplate
                            TargetType="Control">
                            <FZMaterial
                                Preset="{Roundtangle CornerRadius=2}"
                                Color="#26000000"
                                Margin="0,2,0,2" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <local:MappingConverter x:Key="A_ConverterMapping_DefaultTrackAdventureTypeToLeaderboardImage">
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.RacingOnly}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/Racing_Leaderboard.png"/>
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.DriftRun}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/Drift_Leaderboard.png"/>
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.Eliminator}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/Eliminator_Leaderboard.png"/>
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.TougeShowdown}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/TougeShowdown_Leaderboard.png"/>
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.SpecRacing}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/SpecRacing_Leaderboard.png"/>
                <local:MappingConverterEntry Key="{x:Static local:AdventureType.HideSeek}" Value="/ForzaUI;component/Textures/Data_Bound/OnlineAdventurePreview/HideSeek_Leaderboard.png"/>
            </local:MappingConverter>

            <Style x:Key="A_Style_FZTextBlock_LeaderboardPlacement" TargetType="{x:Type FZTextBlock}">
                <Setter Property="Text" Value="{Binding SelectedItem.PositionText, ElementName=PART_LeaderboardList}"/>
                <Setter Property="CapHeight" Value="16"/>
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                <Setter Property="FontFamily" Value="Horizon_C"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding SelectedItem.HasLeaderboardData, ElementName=PART_LeaderboardList}" Value="False">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <FZMaterialGlassCapture />

        <FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}" />
        <Border Style="{StaticResource A_Style_Border_ScenePadding}">
            <Grid>
                <StackPanel Margin="0,-20,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <ContentControl x:Name="ContentControl_SceneTitle"
                                    Content="{local:Loc RoadTrip.IDS_OnlineAdventure_Leaderboard_Title}"
                                    Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                    Margin="0,0,0,16"
                                    HorizontalAlignment="Left"/>
                    <StackPanel Orientation="Horizontal">
                        <WrapListBox x:Name="PART_LeaderboardList"
                                     Height="428"
                                     Width="552"
                                     Template="{StaticResource H_ControlTemplate_TextMenu_Default}"
                                     ScrollOrientation="Vertical"
                                     ItemHeight="54"
                                     ItemWidth="552"
                                     AlternationCount="10000"
                                     ItemsSource="{Binding LeaderboardItems}"
                                     ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Gaps}"
                                     EmptyItemStyle="{StaticResource A_Style_Control_EmptyItemStyle}"
                                     ItemTemplate="{StaticResource A_DataTemplate_TextMenu_Default}" />

                        <FrameworkElement Width="8"/>

                        <StackPanel x:Name="RightSideContainer" Width="510">
                            <FZMaterial Width="510" Height="265" 
                                        Preset="{Roundtangle CornerRadius={CornerRadius TopLeft=2, TopRight=2}}"
                                        ImageSource="{Binding SelectedItem.AdventureType, Converter={StaticResource A_ConverterMapping_DefaultTrackAdventureTypeToLeaderboardImage}, ElementName=PART_LeaderboardList}">
                                <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_LeaderboardPlacement}"
                                             HorizontalAlignment="Center" 
                                             VerticalAlignment="Bottom"
                                             Margin="0,0,0,32"/>
                            </FZMaterial>
                            <FZMaterial Height="15" Preset="{StaticResource A_FZMaterialPresetRoundtangle_HorizonPlayGradient}"/>
                            <FZMaterial Color="#66000000" Preset="{Roundtangle CornerRadius={CornerRadius BottomLeft=2, BottomRight=2}}" Height="148">
                                <FZTextBlock Text="{Binding SelectedItem.MoreInfoText, ElementName=PART_LeaderboardList}"
                                             CapHeight="16"
                                             Color="{StaticResource H_Color_Primary_White}"
                                             TextWrapping="Wrap"
                                             TextAlignment="Center"
                                             AutoScroll.AllowScrolling="True"
                                             AutoScroll="{StaticResource A_AutoScrollSettings_MoreInfoText}"
                                             FontFamily="Horizon_B"
                                             Margin="50,17"/>
                            </FZMaterial>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Border>
        
        <ContentControl
            x:Name="BottomBar"
            Style="{StaticResource A_Style_ButtonBar}">
            <ControllerButtonPanel
                x:Name="PART_HelpPanel"
                Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <ControllerButtonControl
                    Button="A"
                    Description="{Loc HelpButtons.IDS_Select}" />
                <ControllerButtonControl
                    Button="B"
                    Description="{Loc HelpButtons.IDS_Back}" />
            </ControllerButtonPanel>
        </ContentControl>

        <local:NetworkCountdownControl x:Name="TimeRemainingControl" Style="{StaticResource A_Style_NetworkCountdownControl_SeriesEnd}"/>

        <MappingConverterResourcePreloader ValueType="{Type BitmapImage}" Converter="{StaticResource A_ConverterMapping_DefaultTrackAdventureTypeToLeaderboardImage}"/>
    </Grid>
</Page>
