Back to Devexpress

GridControl.GroupBy(String, Boolean) Method

wpf-devexpress-dot-xpf-dot-grid-dot-gridcontrol-dot-groupby-x28-system-dot-string-system-dot-boolean-x29.md

latest3.2 KB
Original Source

GridControl.GroupBy(String, Boolean) Method

Groups data by the values of the specified column.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void GroupBy(
    string fieldName,
    bool mergeWithPreviousGroup = false
)
vb
Public Sub GroupBy(
    fieldName As String,
    mergeWithPreviousGroup As Boolean = False
)

Parameters

NameTypeDescription
fieldNameString

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

|

Optional Parameters

NameTypeDefaultDescription
mergeWithPreviousGroupBooleanFalse

A boolean value that specifies whether the current grouping should be merged with a previous grouping (according to group index).

|

Remarks

The GridControl supports data grouping by an unlimited number of columns. The GroupBy method groups data by the values of the specified column.

Data rows are always sorted against the grouping columns. If data is grouped against a column which isn’t sorted, the grid automatically applies sorting in ascending order to this column.

To learn more, see Grouping.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GroupBy(String, Boolean) method.

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.

wpf-dock-layout-manager-upgrade-layouts-between-versions/CS/MainWindow.xaml.cs#L43

csharp
if (e.RestoredVersion == "1.0") {
    ((GridControl)sender).GroupBy("Group");
}

wpf-dock-layout-manager-upgrade-layouts-between-versions/VB/MainWindow.xaml.vb#L54

vb
If Equals(e.RestoredVersion, "1.0") Then
    CType(sender, GridControl).GroupBy("Group")
End If

See Also

GridControl Class

GridControl Members

DevExpress.Xpf.Grid Namespace