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

Customizing Group Header TItles

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();

3 Replies

MK Muthu Kumaran Gnanavinayagam Syncfusion Team 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. 

PU pumaprog July 20, 2017 01:38 PM UTC

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

MK Muthu Kumaran Gnanavinayagam Syncfusion Team July 21, 2017 04:36 AM UTC

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

Live Chat Icon For mobile
Up arrow icon