# Use Expression Descriptors

This help article will show you how to create generic expression descriptors (SortDescriptor<T>, GroupDescriptors<T> and FilterDescriptors<T>) for **RadGridView**.

## Sorting

You can order your data items by the result of a complex calculation without having to expose it through a read-only property. All you need to do is to use the new **SortDescriptor\<TElement, TKey="">**:

**Example 1: Create a generic SortDescriptor<T>.**

```C#
var descriptor = new SortDescriptor<Employee, double>
{
    SortingExpression = e => e.Orders.SelectMany(o => o.Details).Sum(d => d.UnitPrice * d.Quantity),
    SortDirection = ListSortDirection.Descending
};
```

Then, you should add the defined SortDescriptor to the **SortDescriptors collection** of **RadGridView**.

For more information you can check the [Sorting section](https://www.telerik.com/products/wpf/documentation/controls/radgridview/sorting/basics)

## Grouping

You can also group objects by the result of an equally complex operation:

**Example 2: Create a generic GroupDescriptor<T>.**

```C#
var descriptor = new GroupDescriptor<Employee, int, int>
{
    GroupingExpression = e => e.Orders.Where(o => o.Details.Any(d => d.Product.ProductName.Contains("Syrup"))).Count(),
    SortDirection = ListSortDirection.Ascending
};
```

Then, add the defined GroupDescriptor to the **GroupDescriptors collection** of **RadGridView**.

For more information you can check the [Grouping section](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/basics)

## Filtering

The new FilterDescriptor<T> allows you to directly plug a predicate that determines which items are filtered. You just need to set a lambda to the FilteringExpression property like so:

**Example 3: Create a generic FilterDescriptor<T>.**

```C#
var descriptor = new FilterDescriptor<Employee> { FilteringExpression = e => prospects.Contains(e) };
```

Then, you should add the defined FilterDescriptor to the **FilterDescriptors collection** of **RadGridView**.

For more information you can check the [Filtering section](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/basic)
