Programatically enable/disable grouping in a SfListView list

Hi,

I have a SfListView that needs to be able to have the items grouped or not depending on how the user wishes to view the data in the list. I can't seem to find a way to enable or disable the grouping header.

I am able to change the grouping criteria ok but not show or hide the grouping header.

Am I missing something or is there a workaround I could use?

Thanks,

Andrew



 




3 Replies

RM RiyasHameed MohamedAbdulKhader Syncfusion Team May 20, 2025 02:38 PM UTC

Hi Andrew Elliot,
We have reviewed your query and would like to inform you that you can disable grouping  by using the QueryItemSize event.
To achieve this, you can handle the QueryItemSize event and set the size of the group header items to zero.
We have attached the code snippet and a sample below for your reference.

// Add your group logic here

if (e.ItemType == Syncfusion.Maui.ListView.ItemType.GroupHeader)

{

        e.ItemSize = 0; // Set group header size to zero to hide it

        e.Handled = true;

}


Regards,
RiyasHameed    

Attachment: ListViewSample_6eb1cebb.zip


AE Andrew Elliott May 20, 2025 03:30 PM UTC

Brilliant,


That's solved the issue.


Thanks



RM RiyasHameed MohamedAbdulKhader Syncfusion Team May 21, 2025 01:24 PM UTC

Hi Andrew Elliot,

We are pleased to hear that the provided solution is working well for you. Please feel free to reach out if you require any further assistance.

Regards,

Riyas Hameed M


Loader.
Up arrow icon