Skip to main content

TreeListColumn.SortOrder Property

Gets or sets the column’s sort order.

Namespace: DevExpress.XtraTreeList.Columns

Assembly: DevExpress.XtraTreeList.v23.2.dll

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

Declaration

[DefaultValue(SortOrder.None)]
[XtraSerializableProperty]
[XtraSerializablePropertyId(2)]
public SortOrder SortOrder { get; set; }

Property Value

Type Default Description
SortOrder None

A ColumnSortOrder enumeration value specifying the column’s sort order.

Remarks

Use the SortOrder property to specify whether and how nodes are sorted against a column.

treeList1.Columns["Department"].SortOrder = SortOrder.Ascending;

To remove sorting against a column set its SortOrder property to None. To clear the sort settings for all columns, call the TreeList.ClearSorting method.

The TreeList.BeginSort and TreeList.EndSort methods allow you to avoid superfluous updates when you change sort settings for multiple columns.

Example

The following code sorts data against the Department and Budget columns. The TreeList.BeginSort and TreeList.EndSort methods wrap the code to avoid superfluous updates.

using DevExpress.XtraTreeList.Columns;
//...
treeList1.BeginSort();
treeList1.Columns["Department"].SortOrder = SortOrder.Ascending;
treeList1.Columns["Budget"].SortOrder = SortOrder.Descending;
treeList1.EndSort();

The TreeListColumn.SortIndex property specifies the sorted column’s position among other sorted columns.

See Sorting for more information.

See Also