Skip to main content

TreeList.GetSortColumn(Int32) Method

Gets the column involved in sorting by its index within the sort column collection.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v22.2.dll

NuGet Package: DevExpress.Win.TreeList


public TreeListColumn GetSortColumn(
    int sortIndex


Name Type Description
sortIndex Int32

An integer value representing the zero-based index of the column within the sort column list.


Type Description

A TreeListColumn object representing the requested column. null (Nothing in Visual Basic) if the specified sort column index is negative or exceeds the last available index.


Data displayed by the Tree List control can be sorted by the values of its columns. The columns involved in sorting (whose TreeListColumn.SortOrder property value differs from ColumnSortOrder.None) constitute an ordered list. When sorting by a column’s values, the column is added to the end of this list. When canceling sorting, the column is removed from the list.

You can access a column involved in sorting via the GetSortColumn method. The index of the column in the sort column list must be specified as the parameter. Available indexes range from 0 to the TreeList.SortedColumnCount property value decremented by one.

The GetSortColumn method and the TreeList.SortedColumnCount property can be used in combination to traverse through the columns involved in sorting.


The following sample code uses the TreeList.GetSortColumn method and the TreeList.SortedColumnCount property to traverse through columns involved in sorting.

using DevExpress.XtraTreeList.Columns;
// ...
for(int i = 0; i < treeList1.SortedColumnCount; i++) {
   TreeListColumn sortedColumn = treeList1.GetSortColumn(i);
   // perform desired operations on a sorted column here
See Also