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. Image for the cookie policy date
close icon

Collapse/Expand Icon in CustomGroup Headers

Hello, I have custom group headers in my expanding/collapsing listview.  I would like to show icons for collapsing and expanding in the group header.  I have reviewed the LoadGroupIconSample, but do not see where the GroupCollapse and GroupExpand images are ever referenced, besides in the BoolToImageConverter.  Do you have any other examples of adding icons to the custom group headers?This is in C#.

3 Replies

DB Dinesh Babu Yadav Syncfusion Team June 27, 2017 09:15 AM UTC

Hi Tommy, 
 
Thank you for using Syncfusion Products. 
 
The reported requirement “Loading Expand and Collapse icons in Group Header” can be achieved by customizing the GroupHeaderTemplate such as load an image in the group header template as like below code snippet and by using IsExpand property, which determines whether the group is expanded or collapsed and by using custom converter, you can change the image’s source at runtime as required for example, if IsExpand is true, return Expand icon else return Collapse icon. 
 
Code Example[C#]: 
var image = new Image(); 
Binding binding = new Binding("IsExpand"); 
binding.Converter = new BoolToImageConverter(); 
image.SetBinding(Image.SourceProperty, binding); 
image.HeightRequest = 30; 
image.WidthRequest = 30; 
image.VerticalOptions = LayoutOptions.Center; 
image.HorizontalOptions = LayoutOptions.Center; 
 
grid.Children.Add(image, 0, 0); 
grid.Children.Add(label, 1, 0); 
… 
 
For your reference, we have prepared the sample in code behind as per your requirement and you can download it from the below link. 

   
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 



PU pumaprog June 27, 2017 12:54 PM UTC

Thank you Dinesh.  This example is perfect.



DB Dinesh Babu Yadav Syncfusion Team June 28, 2017 04:47 AM UTC

Hi Tommy, 
 
Thanks for the update. 
 
Regards, 
Dinesh Babu Yadav 
 


Loader.
Live Chat Icon For mobile
Up arrow icon