Skip to main content
A newer version of this page is available. .

TreeList.GetSortColumn(Int32) Method

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

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.1.dll

Declaration

public TreeListColumn GetSortColumn(
    int sortIndex
)

Parameters

Name Type Description
sortIndex Int32

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

Returns

Type Description
TreeListColumn

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.

Remarks

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.

Example

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