New to Telerik UI for WinForms? Download free 30-day trial


The sorting capabilities can be controlled either by using the predefined sorting options in the PropertySort property together with the SortOrder property, or you can use your own sorting by adding a predefined SortDescriptor to the SortDescriptors collection of RadPropertyGrid. The first code snippet demonstrates how to sort the items programmatically in a descending order.

Figure 1: Default Sorting

WinForms RadPropertyGrid Default Sorting

Default Sorting

radPropertyGrid1.PropertySort = PropertySort.Alphabetical;
radPropertyGrid1.SortOrder = SortOrder.Descending;

RadPropertyGrid1.PropertySort = PropertySort.Alphabetical
RadPropertyGrid1.SortOrder = SortOrder.Descending

Another way to sort the items is to create a SortDescriptor and add it to the SortDescriptors collection of the control. Additionally, to enable sorting with sort descriptors, you have to set the EnableSorting property to true.

You can sort by the following criteria’s:

  • Name: The property name.

  • Value: The property value.

  • Category: Assigned from the Category attrubute name.

  • FormattedValue: The value of the property converted to string.

  • Label: By default this is identical to the property name, unless changed by setting the Label property of the item.

  • Description: This is determined by the property Description attribute/

  • OriginalValue: The value used when the property is initialized.

Here is an example of sorting the items by their value in ascending order.

Figure 2: SortDescriptors

WinForms RadPropertyGrid SortDescriptors

Sorting with SortDescriptors

radPropertyGrid1.EnableSorting = true;
SortDescriptor sort = new SortDescriptor("FormattedValue", ListSortDirection.Ascending);

RadPropertyGrid1.EnableSorting = True
Dim sort = New SortDescriptor("FormattedValue", ListSortDirection.Ascending)

The user should clear programmatically the SortDescriptors collection first because there is a default sort order (Ascending) for the properties in the object.

See Also

In this article