<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Trek_12.Views.PageSelectMap"
             Title="PageSelectMap">


    <Grid RowDefinitions="auto,auto,auto">
        <Label Grid.Row="0" Text="Sélection de la Carte" HorizontalOptions="Center" FontSize="Header"/>
        
        <CollectionView Grid.Row="1"
                        ItemsSource="{Binding ListMap}"
                        ItemsLayout="HorizontalList"
                        HorizontalOptions="Center"
                        SelectionMode="Single">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Frame HasShadow="True"
                       BorderColor="DarkGray"
                       CornerRadius="5"
                       Margin="20"
                       HeightRequest="300"
                       WidthRequest="200"
                       HorizontalOptions="Center"
                       VerticalOptions="CenterAndExpand"
                           x:Name="Frame">
                        <Grid RowDefinitions="auto,*">
                            <Label Text="{Binding Background}"
                                   FontAttributes="Bold"
                               FontSize="18"
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                            <Image Source="{Binding Background}"
                                   Aspect="AspectFill"
                               HeightRequest="150"
                               WidthRequest="150"
                               HorizontalOptions="Center"
                                   Grid.Row="1"/>
                        </Grid>
                    </Frame>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
        <Button Text="Retour"
                FontAttributes="Bold"
                FontSize="Large"
                Grid.Row="2"
                HorizontalOptions="Start"
                Margin="100"/>
        <Button Text="Jouer"
                FontAttributes="Bold"
                FontSize="Large"
                Grid.Row="2"
                HorizontalOptions="End"
                Margin="100"/>
    </Grid>
</ContentPage>