Back to Devexpress

How to: Traverse through sort columns

windowsforms-5620-controls-and-libraries-tree-list-examples-sorting-how-to-traverse-through-sort-columns.md

latest945 B
Original Source

How to: Traverse through sort columns

  • Nov 13, 2018

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

csharp
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
   //...
}
vb
Imports DevExpress.XtraTreeList.Columns
' ...
Dim I As Integer
For I = 0 To TreeList1.SortedColumnCount - 1
   Dim SortedColumn As TreeListColumn = TreeList1.GetSortColumn(I)
   ' perform desired operations on a sorted column here
   '...
Next