<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
			 xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
             xmlns:views="clr-namespace:inutralia.Views;assembly=inutralia"
             x:Class="inutralia.Views.TrivialListView"
             x:Name="trivialListPage"
             Title="Trivial">

    <ContentPage.Content>

        <Grid VerticalOptions="FillAndExpand" Padding="20,20,20,20" >

            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
               <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
          
          <!--PARTIDAS-->
          <StackLayout Orientation="Vertical" HorizontalOptions="Fill"  BackgroundColor="{DynamicResource ComplementColor}" Padding="8,8,8,8"  Grid.Row="0" Margin="0,5,0,0">
            <Label Text="PARTIDAS" HorizontalOptions="Center" TextColor="{DynamicResource CustomNavBarTextColor}" />
        

          </StackLayout>
          <!--titulo campos de cada partida-->
          <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"  BackgroundColor="#FF62b9ae" Padding="8,8,8,8" Margin="0,5,0,0" Grid.Row="1">
            <Label Text="Fecha" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
            <Label Text="Respuestas" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />
            <Label Text="Puntuación" IsVisible="{Binding IsCorrect}" HorizontalOptions="CenterAndExpand" TextColor="{DynamicResource CustomNavBarTextColor}" />

          </StackLayout>
            
            <ListView Grid.Row="2"
                      VerticalOptions="FillAndExpand"
                      HorizontalOptions="Fill"
                      SeparatorVisibility="None"
                      SeparatorColor="{ DynamicResource ListViewSeparatorColor }"
                      ItemsSource="{Binding Games}"
                     
                      ItemTapped="ItemTapped"
                      HasUnevenRows="True"
                      x:Name="listGames">
              <ListView.RowHeight>
                <!--<OnIdiom x:TypeArguments="x:Int32"
                         Phone="80"
                         Tablet="120"/>-->
              </ListView.RowHeight>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.ContextActions>
                                <MenuItem Text="Borrar" Command="{Binding Source={x:Reference trivialListPage}, Path=BindingContext.DeleteGameCommand}" CommandParameter="{Binding .}" IsDestructive="True" />
                            </ViewCell.ContextActions>
                            <views:TrivialGameItemTemplate/>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

            <artina:Button	Grid.Row="3"
               Command="{Binding NewGameCommand}"
							Style="{DynamicResource PrimaryActionButtonStyle}"
							Text="Nueva partida"
                            VerticalOptions="End"
							WidthRequest="{ artina:OnOrientationDouble
							LandscapePhone=200,
							LandscapeTablet=400 }"
							HorizontalOptions="{ artina:OnOrientationLayoutOptions
							PortraitPhone=Fill,
							LandscapePhone=Center,
							PortraitTablet=Fill,
							LandscapeTablet=Center }"/>
        </Grid>
        
    </ContentPage.Content>
</ContentPage>