ComponentOne Grid for WPF: Run-Time Interaction > Sorting Columns

Sorting Columns

Sorting grid columns at run time is simple in ComponentOne Grid for WPF. To sort columns click once on the header of the column that you wish to sort.

In the image below, the Name column is sorted; you will notice that the sort glyph, a sort direction indicator, appears when a column is sorted:

 

You can click once again on the column header to reverse the sort; notice that the sort glyph changes direction:

 

Sort multiple columns by sorting one column and then holding the CTRL key while clicking on a second column header to add that column to your sort condition. For example, in the following image the In Stock column was first sorted and then the Price column was reverse sorted:

 

You can easily prevent the grid or a column in the grid from being sorted by setting the AllowSort property to False. For more information, see Preventing the Grid from Being Sorted and Preventing a Column from Being Sorted.

You can customize the sort direction indicators by using the AscendingSortIndicatorTemplate and DescendingSortIndicatorTemplate properties. See Changing the Appearance of the Sort Indicator for an example of changing the appearance of the sort indicator.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.