menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GroupColumnDescription - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GroupColumnDescription

    Represents a class for that contains the grouping information like group column's name and converter based on which grouping for a column is processed in a SfDataGrid.

    Inheritance
    System.Object
    GroupColumnDescription
    Namespace: Syncfusion.SfDataGrid.XForms
    Assembly: Syncfusion.SfDataGrid.XForms.dll
    Syntax
    public class GroupColumnDescription : BindableObject

    Constructors

    GroupColumnDescription()

    Initializes a new instance of the GroupColumnDescription class.

    Declaration
    public GroupColumnDescription()

    Fields

    ColumnNameProperty

    Identifies the ColumnName Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty ColumnNameProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    ComparerProperty

    Identifies the GroupColumnDescription.Comparer Xamarin.Forms.BindableProperty property.

    Declaration
    public static readonly BindableProperty ComparerProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    ConverterProperty

    Identifies the Converter Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty ConverterProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    KeySelectorProperty

    Identifies the KeySelector Xamarin.Forms.BindableProperty property.

    Declaration
    public static readonly BindableProperty KeySelectorProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    SortGroupRecordsProperty

    Identifies the SortGroupRecords Xamarin.Forms.BindableProperty property.

    Declaration
    public static readonly BindableProperty SortGroupRecordsProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    Properties

    ColumnName

    Gets or sets the column name for grouping. This property represents the MappingName of the column which should be grouped.

    Declaration
    public string ColumnName { get; set; }
    Property Value
    Type Description
    System.String

    The column name for grouping.

    Examples
    dataGrid.GroupColumnDescriptions.Add (new GroupColumnDescription () {
    ColumnName = "CustomerID",
    });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/grouping#programmatic-grouping

    Comparer

    Gets or sets the comparer for the apply grouping based on custom logic.

    Declaration
    public IComparer<object> Comparer { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IComparer<System.Object>

    The comparer for apply grouping based on custom logic. The default value is null.

    Converter

    Gets or sets the converter for grouping. This property is used when the user needs to group the column with their custom logic. The user must assign the converter class implementing the Xamarin.Forms.IValueConverter to this property.

    Declaration
    public IValueConverter Converter { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.IValueConverter

    The converter for grouping.

    Remarks

    SfDataGrid allows you to group a column based on custom logic when the standard grouping techniques do not meet the requirements. When the user wants to apply grouping to the column based on his custom logic, he needs to the write the converter class implementing the Xamarin.Forms.IValueConverter and assign it to this property.

    Examples
    dataGrid.GroupColumnDescriptions.Add (new GroupColumnDescription () {
    ColumnName = "CustomerID",
    Converter = new GroupConverter()
    });
    
    //GroupConverter.cs
    public class GroupConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var orderInfo = value as OrderInfo;
            if (orderInfo.Freight > 0 && orderInfo.Freight <= 250)
                return "<=250";
            else if (orderInfo.Freight > 250 && orderInfo.Freight <= 500)
                return ">250 & <=500";
            else if (orderInfo.Freight > 500 && orderInfo.Freight <= 750)
                return ">500 & <=750";
            else
                return ">1000";
        }
    }
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/grouping#custom-grouping

    KeySelector

    Gets or sets the keyselector for applying custom grouping logic. The user must assign the Function System.Func<, , > to this property.

    Declaration
    public Func<string, object, object> KeySelector { get; set; }
    Property Value
    Type Description
    System.Func<System.String, System.Object, System.Object>

    The KeySelector for apply grouping based on custom logic. The default value is null.

    Examples
    dataGrid.GroupColumnDescriptions.Add (new GroupColumnDescription () {
    ColumnName = "OrderID",
    KeySelector = (string ColumnName, object o) =>
            {
            var freight = (o as OrderInfo).Freight;
            if (freight > 0 && freight <= 250)
                return "<=250";
            else if (freight > 250 && freight <= 500)
                return ">250 & <=500";
            else if (freight > 500 && freight <= 750)
                return ">500 & <=750";
            else
                return ">1000";
        });
      });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/grouping#custom-grouping

    SortGroupRecords

    Gets or sets a value indicating whether to sort the inner records of the group while using custom grouping.

    Declaration
    public bool SortGroupRecords { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false.

    Remarks

    By default, grouped column's records are not sorted since the values of all the records in a group will be the same. So, groups will only be sorted based on group key. In custom grouping cases, grouped column's record values may differ. So in this case, you can sort the records of a group by setting the SortGroupRecords property to true.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved