# Delegate Group Descriptor for .NET MAUI DataGrid

The difference between the `DelegateGroupDescriptor` and the [PropertyGroupDescriptor](https://www.telerik.com/maui-ui/documentation/controls/datagrid/grouping/property-group-descriptor) 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.

To specify the content that is used to represent the group descriptor visually within the grouping panel, set the `DisplayContent` (`object`) property.

> note 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:

```C#
class CustomIKeyLookup : Telerik.Maui.Controls.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:

```C#
this.dataGrid.GroupDescriptors.Add(new DelegateGroupDescriptor() { DisplayContent = "Name", KeyLookup = new CustomIKeyLookup() });
```

```XAML
<telerik:RadDataGrid x:Name="dataGrid"
                     ItemsSource="{Binding People}" />
```

Here is how the [.NET MAUI DataGrid](https://www.telerik.com/maui-ui/documentation/controls/datagrid/overview) looks when is grouped through a `DelegateGroupDescriptor`:

![.NET MAUI DataGrid grouped with a DelegateGroupDescriptor using a custom group key](https://www.telerik.com/maui-ui/documentation/assets/e99acc9e26ff561e7a45637013309d8d/datagrid-delegate-group-descriptor.png)
