Skip to main content
A newer version of this page is available. .

GridControl.SortBy(GridColumn) Method

Sorts data against the specified column.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public void SortBy(
    GridColumn column
)

Parameters

Name Type Description
column GridColumn

A column within the GridControl.

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.

The SortBy(GridColumn) method sorts data in ascending order. To specify the sort order or sort condition index within the GridSortInfoCollection, call the SortBy(GridColumn, ColumnSortOrder) and SortBy(GridColumn, ColumnSortOrder, Int32) methods, respectively.

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

See Also