<?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"
             xmlns:pageModels="clr-namespace:MauiBrokenBindings.PageModels"             
             xmlns:models="clr-namespace:MauiBrokenBindings.Models"
             xmlns:controls="clr-namespace:MauiBrokenBindings.Pages.Controls"
             xmlns:pullToRefresh="clr-namespace:Syncfusion.Maui.Toolkit.PullToRefresh;assembly=Syncfusion.Maui.Toolkit"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
             xmlns:system="using:System"
             x:Class="MauiBrokenBindings.Pages.MainPage"
             x:DataType="pageModels:MainPageModel"
             x:Name="ContentPage"
             Title="Bugged Page">

    <CollectionView x:Name="DataListView" IsGrouped="False" ItemSizingStrategy="MeasureAllItems">
        <CollectionView.ItemsLayout>
            <GridItemsLayout x:Name="GridItemsLayout" Orientation="Vertical" Span="2" />
        </CollectionView.ItemsLayout>
        <CollectionView.ItemTemplate>
            <DataTemplate x:DataType="pageModels:DataModel">
                <Grid>
                    <Border BackgroundColor="{DynamicResource DarkerBackgroundColor}" Margin="10" Padding="0" HeightRequest="96" MaximumWidthRequest="144" HorizontalOptions="Fill">
                        <Border.GestureRecognizers>
                            <TapGestureRecognizer Command="{Binding BindingContext.DataSelectedCommand, Source={x:Reference ContentPage}}" CommandParameter="{Binding}" />
                        </Border.GestureRecognizers>

                        <Grid RowSpacing="0" Margin="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Label Grid.Row="1" Text="{Binding Text, Mode=OneTime}" FontSize="11" FontAttributes="Bold" HorizontalTextAlignment="Center" LineBreakMode="TailTruncation" Margin="10" />
                        </Grid>
                    </Border>
                </Grid>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</ContentPage>
