<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="CollectionViewDemos.Views.FirstPage"
             xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:viewModels="clr-namespace:CollectionViewDemos.ViewModels"
             Title="FirstPage">
    <ContentPage.BindingContext>
        <viewModels:MonkeysViewModel />
    </ContentPage.BindingContext>

    <VerticalStackLayout>
        <CollectionView ItemsSource="{Binding Monkeys}">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Grid Padding="10"
                          ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto">
                        <Image Grid.RowSpan="2"
                               Aspect="AspectFill" HeightRequest="60"
                               Source="{Binding ImageUrl}"
                               WidthRequest="60" />
                        <Label Grid.Column="1"
                               FontAttributes="Bold"
                               Text="{Binding Name}" />
                        <Label Grid.Row="1" Grid.Column="1"
                               FontAttributes="Italic"
                               Text="{Binding Location}"
                               VerticalOptions="End" />
                    </Grid>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </VerticalStackLayout>
</ContentPage>