Skip to main content

GridControl.SortBy(GridColumn, ColumnSortOrder) Method

Sorts data against the specified column and arranges it according to the sort order.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.1.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public void SortBy(
    GridColumn column,
    ColumnSortOrder sortedOrder
)

Parameters

Name Type Description
column GridColumn

A column within the GridControl.

sortedOrder ColumnSortOrder

Sort order of the specified column.

Remarks

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

Call the SortBy(GridColumn, ColumnSortOrder, Int32) method to specify the sort condition index within the GridSortInfoCollection.

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

See Also