windowsforms-devexpress-dot-xtragrid-dot-columns-dot-gridcolumn-a864b695.md
Groups data by the values of the current column.
Namespace : DevExpress.XtraGrid.Columns
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public void Group()
Public Sub Group
Grid Views support grouping data by an unlimited number of columns. To group data by the values of a given column, call its Group method. Calling this method has no effect if data is already grouped by the values of this column. If several columns are involved in grouping, the current column will reside at the bottom grouping level after calling its Group method.
To ungroup data by the values of a single column, use the column’s GridColumn.UnGroup method. To clear grouping completely, call the View’s GridView.ClearGrouping method.
Please refer to the Grouping and End-User Capabilities: Grouping topics for detailed information on data grouping in the Grid Control.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Group() 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.
gridView1.Columns["OrderDate"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
gridView1.Columns["Country"].Group();
gridView1.Columns["City"].Group();
winforms-grid-multiple-row-selection-web-style-checkboxes/CS/E1271/Form1.cs#L36
private void Form1_Load(object sender, EventArgs e) {
gridView1.Columns["ParentID"].Group();
gridView1.ExpandAllGroups();
summaryMax = (GridGroupSummaryItem)gridView1.GroupSummary.Add(SummaryItemType.Max, "Unit Price");
gridView1.Columns["Discontinued"].Group();
gridView1.GroupFormat = "{0}: [#image]{1} "; // summaries are hidden for simpler string composing in CustomDrawGroupRow
winforms-grid-hide-vertical-lines-between-certain-columns/CS/E3647/Form1.cs#L69
{
gridView1.Columns["Number"].Group();
gridView1.ExpandAllGroups();
gridView1.Columns("OrderDate").DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
gridView1.Columns("Country").Group()
gridView1.Columns("City").Group()
winforms-grid-multiple-row-selection-web-style-checkboxes/VB/E1271/Form1.vb#L35
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
gridView1.Columns("ParentID").Group()
gridView1.ExpandAllGroups()
summaryMax = CType(gridView1.GroupSummary.Add(SummaryItemType.Max, "Unit Price"), GridGroupSummaryItem)
gridView1.Columns("Discontinued").Group()
gridView1.GroupFormat = "{0}: [#image]{1} " ' summaries are hidden for simpler string composing in CustomDrawGroupRow
winforms-grid-hide-vertical-lines-between-certain-columns/VB/E3647/Form1.vb#L66
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
gridView1.Columns("Number").Group()
gridView1.ExpandAllGroups()
See Also