<?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:sfListView="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
    xmlns:sfDataSource="clr-namespace:Syncfusion.Maui.DataSource;assembly=Syncfusion.Maui.DataSource"
             x:Class="SFGroupedListView.MainPage">

    <Grid>
        <sfListView:SfListView
                    AutoFitMode="DynamicHeight"
                    ItemSpacing="0,5"
                    ItemsSource="{Binding DocumentCategories}"
                    SelectionMode="None">

            <sfListView:SfListView.DataSource>
                <sfDataSource:DataSource>
                    <sfDataSource:DataSource.GroupDescriptors>
                        <sfDataSource:GroupDescriptor PropertyName="CategoryName" />
                    </sfDataSource:DataSource.GroupDescriptors>
                </sfDataSource:DataSource>
            </sfListView:SfListView.DataSource>
            <sfListView:SfListView.GroupHeaderTemplate>
                <DataTemplate>
                    <VerticalStackLayout BackgroundColor="LightGray" Padding="10,5">
                        <Label Text="{Binding Key}" FontSize="20"/>
                    </VerticalStackLayout>
                </DataTemplate>
            </sfListView:SfListView.GroupHeaderTemplate>
            <sfListView:SfListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <VerticalStackLayout Margin="0,5">
                                <Label Margin="10,5" Text="{Binding ItemName}" TextColor="Black"/>
                                <Entry Margin="10,5,0,0" Placeholder="Enter text here"/>
                                <Line HeightRequest="1" Margin="0,15,0,0" BackgroundColor="Gray"/>
                            </VerticalStackLayout>
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </sfListView:SfListView.ItemTemplate>
            <sfListView:SfListView.FooterTemplate>
                <DataTemplate>
                    <Grid HeightRequest="20" />
                </DataTemplate>
            </sfListView:SfListView.FooterTemplate>
        </sfListView:SfListView>

    </Grid>

</ContentPage>
