Edit this page


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 SortDescriptor collection of RadPropertyGrid. The first code snippet demonstrates how to sort the items programmatically in a descending order.

Figure 1: Default Sorting

propertygrid-features-sorting 001

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

propertygrid-features-sorting 002

Sorting with SortDescriptors

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

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

See Also