Skip to main content
A newer version of this page is available. .
All docs
V21.2

TreeListControlBase.SortBy(TreeListColumn, ColumnSortOrder, Int32) Method

Sorts data against the specified column and arranges it according to the sort order. The position of the sort condition within the TreeListSortInfoCollection depends on the sortIndex parameter.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public void SortBy(
    TreeListColumn column,
    ColumnSortOrder sortOrder,
    int sortIndex
)

Parameters

Name Type Description
column TreeListColumn

A column within the TreeListControl.

sortOrder ColumnSortOrder

Sort order of the specified column.

sortIndex Int32

The index of the specified sort condition within the TreeListSortInfoCollection.

Remarks

The TreeListControl allows you to sort data against multiple columns. Call the SortBy method to apply a new sort condition. The TreeListControl creates a new GridSortInfo object that stores sort parameters, and appends this object to the TreeListSortInfoCollection. The sort operation result depends on the order of the applied conditions within the collection. If the TreeListSortInfoCollection already contains a sort condition for the specified column, the TreeListControl replaces this condition with a new condition.

If the sortIndex parameter exceeds the index of the last element within the TreeListSortInfoCollection, the TreeListControl appends the GridSortInfo object to the collection. Pass a negative value as the sortIndex parameter to remove the applied sort condition.

Refer to the following topics for more information: Sorting in Code and Sort Nodes.

See Also