<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_PreRaceChampionshipStandings"
      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>
        <ResourceDictionary>
            <Style x:Key="A_Style_PlayerListControl_ChampionshipStandings" TargetType="local:PlayerListControl" BasedOn="{StaticResource A_Style_PlayerListControl_Default}">
                <Style.Resources>
                    <Style x:Key="A_Style_ColumnDefinition_Points" TargetType="{x:Type ColumnDefinition}">
                        <Setter Property="Width" Value="80"/>
                    </Style>
                </Style.Resources>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_EventDetails" TargetType="local:FZTextBlock">
                <Setter Property="Color" Value="#FFFFFFFF"/>
                <Setter Property="CapHeight" Value="20"/>
                <Setter Property="FontFamily" Value="Horizon_B"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">
        <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}"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>
    
        <Border Style="{StaticResource A_Style_Border_ScenePadding}"
                UseLayoutRounding="True">
            <Grid>
                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,0,0,50">
                    <StackPanel Orientation="Vertical"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center">
                        <Decorator Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                            <ContentControl x:Name="eventResultsTextBlock"
                                            Content="{local:Loc ScreenTitles.IDS_ChampionshipStandings}"
                                            Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                                            local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Leaderboards.png"
                                            Panel.ZIndex="10" 
                                            HorizontalAlignment="Left"/>
                        </Decorator>

                        <StackPanel Orientation="Horizontal" Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                            <local:PlayerListControl x:Name="PART_PlayerList"
                                                     DataContext="{Binding EventViewModel.Participants}"
                                                     ShowPosition="True"
                                                     ShowPoints="True"
                                                     ForceSelection="True"
                                                     Panel.ZIndex="2"
                                                     Style="{StaticResource A_Style_PlayerListControl_ChampionshipStandings}"/>

                            <DockPanel Style="{StaticResource A_Style_DockPanel_MultiplayerGrid_InstructionalPanel}">
                                <ContentControl DockPanel.Dock="Top" Style="{StaticResource A_Style_ContentControl_Header_Custom}" Height="80">
                                    <StackPanel Orientation="Horizontal">
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HeaderBlock}" Margin="0" Text="{local:Loc Scoreboard.IDS_Event}" HorizontalAlignment="Left"/>
                                        <Decorator Width="12"/>
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HeaderBlock}" Margin="0" Text="{Binding EventProgress, Converter={StaticResource A_StringToUpper}}" HorizontalAlignment="Right"/>
                                    </StackPanel>
                                </ContentControl>
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_InstructionPanelBackgroundLast}">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="324"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <local:MapViewControllerWindowed x:Name="PreRaceChampStandingsMapView"
                                                                         DataContext="{Binding RouteMap}"
                                                                         Style="{StaticResource A_Style_MapViewController_UIMap}" />
                                        <local:MapCustomRenderElement Style="{StaticResource A_Style_MapCustomRenderElement_Leaderboard}" Grid.Row="0" DataContext="{Binding RouteMap}" Width="356" Height="324"
                                                                      MapView="{Binding ElementName=PreRaceChampStandingsMapView}" />
                                        <StackPanel Grid.Row="1" VerticalAlignment="Center" Margin="20">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_EventDetails}" FontFamily="Horizon_A" CapHeight="24" Text="{Binding TrackName}"/>
                                            <Decorator Height="12"/>
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_EventDetails}" Text="{Binding RaceModeName}"/>
                                            <Decorator Height="12"/>
                                            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_EventDetails}" Text="{Binding NumLaps}" Visibility="{Binding NumLaps, Converter={StaticResource A_StringVisConverter}}"/>
                                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_EventDetails}" 
                                                                   Text="{local:Loc Scoreboard.IDS_EventDetails_DistanceDivider}" 
                                                                   Visibility="{Binding NumLaps, Converter={StaticResource A_StringVisConverter}}" 
                                                                   Margin="6,0"/>
                                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_EventDetails}" Text="{Binding RouteMap.Distance}"/>
                                            </StackPanel>
                                        </StackPanel>

                                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FloatingIconShadow}" Margin="0,-66,0,0" Grid.Row="2">
                                            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_StartingGrid_RaceIcon}" VerticalAlignment="Top"/>
                                        </local:FZMaterial>
                                    </Grid>
                                </local:FZMaterial>
                            </DockPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Page>
