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.
Unfortunately, activation email could not send to your email. Please try again.

Collapse/Expand Icon in CustomGroup Headers

Thread ID:

Created:

Updated:

Platform:

Replies:

131176 Jun 26,2017 02:16 PM Jun 28,2017 12:47 AM Xamarin.Forms 3
loading
Tags: SfListView
pumaprog
Asked On June 26, 2017 07:38 PM

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#.

Dinesh Babu Yadav [Syncfusion]
Replied On June 27, 2017 05:15 AM

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 
 


pumaprog
Replied On June 27, 2017 08:54 AM

Thank you Dinesh.  This example is perfect.


Dinesh Babu Yadav [Syncfusion]
Replied On June 28, 2017 12:47 AM

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


CONFIRMATION

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.

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.

;