ListView Header remains visible after switching IsGroupingEnabled to false
Hi,
I've ported Xamarin Forms application to .NET 7.0 and I keep encountering various issues with basic functionality that worked as expected in Xamarin Forms.
Right now I'm targeting Android API 30 with my .NET 7.0 MAUI app.
The issue :
I have a ListView with items and no headers.
If user taps a button I group entries and show them with Headers in the Listview by switching IsGroupingEnabled to true.
Listview has GroupHeaderTemplate set as such :
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Label
FontFamily="NubbuBold"
FontSize="Large"
HorizontalOptions="Center"
Text="{Binding HeaderPrice}"
TextColor="Purple"
VerticalOptions="Center" />
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
From code behind that disabled the grouping :
if (isGroupingByStatus)
{
Calculate.BackgroundColor = Color.FromArgb("#437c17");
MainListView.IsGroupingEnabled = false;
isGroupingByStatus = false;
MainListView.ItemsSource = null;
MainListView.ItemsSource = ((ViewInventureItemsVM)BindingContext)._Inventures[0].InventoryItems;
return;
}
This code works in Xamarin Forms and my list is grouped as expected.
In MAUI when I disable Grouping on ListView, the header columns remain visible with no data in them.
I have tried to set GroupHeader template to null, as well as doing it before setting new item source to the list, it didn't help
I have tried to set ItemSource to null prior to disabling grouping, it didn't help.
I hope that I'm doing something wrong, and that this is not one of the dozens of issues with MAUI that I've run into while porting my application to the point of me just giving up on porting. My app is ported 99% to MAUI from new project and I keep running into issues with basic functionality.
Thanks.