<Page xmlns:local="clr-namespace:ForzaUI"
      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" 
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.Scenes.Anthem.A_OnlineEventPreRace"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"> 

    <Page.Resources>
        <ResourceDictionary>

    	<Style x:Key="A_Style_TextBlock_ScreenTitle_Placeholder" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource A_Style_TextBlock_Title}" />
    	<Style x:Key="A_Style_TextBlock_InactiveTitle_Placeholder" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource A_Style_TextBlock_SubHeading_Button}"/>
    	<local:NumUnitConverter x:Key="A_NumUnitConverter_XPConverter" FractionDigits="0"/>

    	<Style x:Key="A_Style_StackPanel_ParticipantItem" TargetType="{x:Type StackPanel}">
    		<Setter Property="Background">
    			<Setter.Value>
    				<SolidColorBrush Color="{StaticResource A_Color_Header_Text}" />
    			</Setter.Value>
    		</Setter>
    		<Style.Triggers>
    			 <DataTrigger Binding="{Binding Team}" Value="0">
    				<Setter Property="Background">
    					<Setter.Value>
    						<SolidColorBrush Color="{StaticResource A_Color_Leaderboard_Background_TeamRed}" />
    					</Setter.Value>
    				</Setter>
    			</DataTrigger>
    			 <DataTrigger Binding="{Binding Team}" Value="1">
    				<Setter Property="Background">
    					<Setter.Value>
    						<SolidColorBrush Color="{StaticResource A_Color_Leaderboard_Background_TeamBlue}" />
    					</Setter.Value>
    				</Setter>
    			</DataTrigger>

				<!-- TODO - highlight local player and team colour -->
    			 <DataTrigger Binding="{Binding IsLocalPlayer}" Value="True">
    				<Setter Property="Background">
    					<Setter.Value>
    						<SolidColorBrush Color="{StaticResource A_Color_Stat_Positive}" />
    					</Setter.Value>
    				</Setter>
    			</DataTrigger>

    		</Style.Triggers>
    	</Style>
				 </ResourceDictionary>
    </Page.Resources>

	<local:ZPanel x:Name="LayoutRoot" 
		Width="1280"
		Height="720" 
		HorizontalAlignment="Center">

		<Grid Width="1280"
			Height="720"  >
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width=".3*"/>
				<ColumnDefinition/>
				<ColumnDefinition Width=".3*"/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height=".3*"/>
				<RowDefinition/>
				<RowDefinition Height=".3*"/>
			</Grid.RowDefinitions>

			<Grid Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center">
				<local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ScreenTitle_Background}" />

				<TextBlock Text="{local:Loc ScreenTitles.IDS_EventParticipants}" Style="{StaticResource A_Style_TextBlock_ScreenTitle_Placeholder}" Margin="15,0">
					<TextBlock.Foreground>
						<SolidColorBrush Color="{StaticResource A_Color_ScreenTitle_Text}"/>
					</TextBlock.Foreground>
				</TextBlock>
			</Grid>

			<Grid Grid.Column="2" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Center">
				<local:FZMaterial Style="{StaticResource A_Style_FZMaterial_InactiveTitle_Background}" />

				<TextBlock Text="Placeholder" Style="{StaticResource A_Style_TextBlock_InactiveTitle_Placeholder}" Margin="15,0">
					<TextBlock.Foreground>
						<SolidColorBrush Color="{StaticResource A_Color_InactiveTitle_Text}"/>
					</TextBlock.Foreground>
				</TextBlock>
			</Grid>

			<Grid Grid.Column="1" Grid.Row="1">
				<local:FZMaterial Style="{StaticResource A_Style_FZMaterial_InactiveTitle_Background}" Color="DarkGray" Margin="0,0,0,60" />
				<ItemsControl ItemsSource="{Binding EventViewModel.Participants}" Margin="0,0,0,60">
					<ItemsControl.Template>
						<ControlTemplate>
							<StackPanel Orientation="Vertical" IsItemsHost="True" Margin="0,0,0,-70"/>
						</ControlTemplate>
					</ItemsControl.Template>
					<ItemsControl.ItemTemplate>
						<DataTemplate>
							<StackPanel Orientation="Horizontal" Tag="{Binding IsLocalPlayer}" Style="{StaticResource A_Style_StackPanel_ParticipantItem}">
								<TextBlock Text="{Binding PlayerName}" Margin="15,5,15,5" Style="{StaticResource A_Style_TextBlock_AnthemA}" />
								<TextBlock Text="{Binding CarName}" Margin="15,5,15,5" Style="{StaticResource A_Style_TextBlock_AnthemA}" />
							</StackPanel>
						</DataTemplate>
					</ItemsControl.ItemTemplate>
				</ItemsControl>
			</Grid>

		</Grid>
	</local:ZPanel>
</Page>
