Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataControlBase.SortBy(String) Method

Sorts data by the values of the specified column.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

public void SortBy(
    string fieldName
)

#Parameters

Name Type Description
fieldName String

A String value that specifies the column’s field name.

#Remarks

Data can be sorted by multiple columns. Any previous sorting is not cleared when calling the SortBy method.

If the control’s data is not sorted by the specified column, the SortBy method sorts data by its values in ascending order. The new sort order applies an additional sorting condition to the one previously applied. The control creates a new GridSortInfo object with the specified settings, and appends it to the GridControl.SortInfo collection. Otherwise, if data is already sorted by the specified column, the SortBy method does nothing.

End-users are allowed to sort data if the view’s DataViewBase.AllowSorting property is set to true.

To learn more, see Sorting in Code and Sorting.

See Also