Skip to main content

GridSortInfo.FieldName Property

Gets or sets the field name of the column to sort. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public string FieldName { get; set; }

Property Value

Type Description
String

A String value that specifies the field name of the column to sort.

Remarks

The FieldName property specifies the column whose values are sorted in the order specified by the ColumnBase.SortOrder property.

To learn more, see Sorting in Code.

Example

This example shows how to apply data sorting and grouping in XAML.

Since group rows are always sorted, data grouping requires data sorting. Sorting applied to group columns takes priority over other columns. To group data by one column in XAML, do the following:

The image below shows the result:

exGroupingSortingInCode

using System.ComponentModel;
using DevExpress.Xpf.Grid;

public Window1() {
    InitializeComponent();
    grid.DataSource =
        new dsNwindProductsTableAdapters.ProductsTableAdapter().GetData();
    CreateSortInfo(grid);
}
private void CreateSortInfo(GridControl grid) {
    grid.SortInfo.Add(new GridSortInfo("UnitPrice", ListSortDirection.Descending));
    grid.SortInfo.Add(new GridSortInfo("ProductName", ListSortDirection.Ascending));
    grid.GroupCount = 1;
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FieldName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also