New to Telerik UI for .NET MAUI? Start a free 30-day trial

Delegate Group Descriptor

The difference between the DelegateGroupDescriptor and the PropertyGroupDescriptor is that the DelegateGroupDescriptor groups data by a custom key, while the PropertyGroupDescriptor groups by a defined key which is a property from the model.

You have to set the KeyLookup property of the DelegateGroupDescriptor, which gets or sets the IKeyLookup instance that is used to retrieve the group key for each data item.

You can sort the groups in ascending or descending order by using the SortOrder property.

You have to create a class that implements the IKeyLookup interface which will return the key by which you want to group. Then, you need to add the DelegateGroupDescriptor to the RadDataGrid.GroupDescriptors collection and set its KeyLookup property.

The following example demonstrates a sample IKeyLookup implementation:

class CustomIKeyLookup : Telerik.Maui.Controls.Compatibility.Common.Data.IKeyLookup
{
    public object GetKey(object instance)
    {
        var item = instance as Person;
        return item?.Name[0];
    }
}

Add it to the GroupDescriptors collection of the RadDataGrid instance:

this.dataGrid.GroupDescriptors.Add(new DelegateGroupDescriptor() { KeyLookup = new CustomIKeyLookup() });

Here is how the DataGrid looks when it is grouped through a DelegateGroupDescriptor:

DataGrid Delegate GroupDescriptor

In this article
Not finding the help you need?