Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeList.SortedColumnCount Property

Gets the number of columns involved in sorting.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

#Declaration

[Browsable(false)]
public int SortedColumnCount { get; }

#Property Value

Type Description
Int32

An integer value representing the number of columns involved in sorting.

#Remarks

The Tree List control gives you the ability to sort its data by the values of multiple columns. This can be applied by setting the TreeListColumn.SortOrder property of columns to a value that differs from ColumnSortOrder.None. When column sorting is applied, the column is added to the internal sort column list. If column sorting is cancelled, the column is removed from this list.

The SortedColumnCount property returns the number of columns in the sort column list. Individual columns from this list can be obtained via the TreeList.GetSortColumn method call. You can use these two members 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