We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sf Listview: Collapse all other groups when one is expanded

Thread ID:





130303 May 5,2017 06:17 AM UTC May 8,2017 08:29 AM UTC Xamarin.Forms 1
Tags: SfListView
Asked On May 5, 2017 06:17 AM UTC


As the title suggests , how can I collapse all but the selected group?


Dinesh Babu Yadav [Syncfusion]
Replied On May 8, 2017 08:29 AM UTC

Hi Customer,

Thank you for using Syncfusion Products.
We have checked the reported query “Need to Collapse all other groups when one group is expanded” at our end and we would like to let you know that the reported requirement can be achieved by using GroupExpanding event which will be triggered whenever a particular group is being expanded and the particular selected group can be get from GroupExpandCollapseChangingEventArgs by which you can compare and collapse all other groups and expand the particular selected group as highlighted in the below code snippets. 
Code Example[C#]: 
private void ListView_GroupExpanding(object sender, GroupExpandCollapseChangingEventArgs e) 
  if (e.Groups.Count > 0) 
    var group = e.Groups[0]; 
    if (expandedGroup == null || group.Key != expandedGroup.Key) 
      foreach (var otherGroup in listView.DataSource.Groups) 
        if (group.Key != otherGroup.Key) 
      expandedGroup = group; 
For your assistance we have prepared a working sample and you can download it from the below link. 
Please let us know if you require further assistance. 
Dinesh Babu Yadav 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon