Edit this page

Use generic SortDescriptor

This help article will show you how to create generic expression SortDescriptor for RadGridView.

Generic SortDescriptor

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:

Example 1: Create a generic SortDescriptor.

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.

See Also