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

Customizing Group Header TItles

Thread ID:





131621 Jul 20,2017 02:46 AM UTC Jul 21,2017 04:36 AM UTC Xamarin.Forms 3
Tags: SfListView
Asked On July 20, 2017 02:46 AM UTC

Hello - I am using a group descriptor to group items on an sfListView.  The Property that is being used is called "Checked", which brings in a 1 or 0 value.  So, with the group headers, the two groups are called 1 and 0.  I'd like to call them 'Failed' and 'Passed', respectively.  Is there a way to convert the property in the group headers to another value?

            listView.DataSource.GroupDescriptors.Add(new GroupDescriptor()
                PropertyName = "Checked",
                KeySelector = (object obj1) =>
                    var item = (obj1 as HistoryItem);
                    return item.Checked.ToString();

Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On July 20, 2017 11:49 AM UTC

Hi Tommy, 
We have checked your query “Need to customize GroupHeader title” from our side. You can customize the GroupHeader title based on the value obtained from the ‘Checked’ property by using Converter. 
In the Converter, you need to check whether the value obtained is ‘1’ or ‘0’ and convert into required string value[‘Passed’ or ‘Failed’]. Please refer the below code example to know how to change the GroupHeader Key value using IntToStringConverter. 
Code example:[C#] 
public class IntToStringConverter : IValueConverter 
  public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
    if (value.ToString() == "1") 
      return "Passed"; 
    return "Failed"; 
  public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 
    throw new NotImplementedException(); 
Code example:[XAML] 
<DataTemplate x:Name="GroupHeaderTemplate"  x:Key="GroupHeaderTemplate"> 
      <Grid BackgroundColor="#E4E4E4"> 
          <ColumnDefinition Width="*" /> 
          <Label Text="{Binding Key,Converter={StaticResource IntToStringConverter}}" 
                 Margin="20,0,0,0" /> 
For your reference we have attached the working sample link below, 
Please let us know if you require further assistance. 
G.Muthu Kumaran. 

Replied On July 20, 2017 01:38 PM UTC

Thanks for the response, Muthu!  This solution worked perfectly!

Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On July 21, 2017 04:36 AM UTC

Hi Tommy, 
Thanks for the update. 
G.Muthu Kumaran. 


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