Skip to main content

GridView.GroupFormat Property

Gets or sets the format rule that specifies a template for group row captions. You can build this template from custom text strings and the following placeholders: {0}, {1}, {2} and [#image].

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation


[DefaultValue("{0}: [#image]{1} {2}")]
public virtual string GroupFormat { get; set; }

Property Value

Type Default Description
String "{0}: [#image]{1} {2}"

A string value specifying the text pattern for group rows.


The default group format contains all four available placeholders: “{0}: [#image]{1} {2}”. For instance, “Category: <Image> Seafood (Count = 26)”.


  • {0} - the group column caption. In the example above, {0} is a placeholder for “Category”.

  • {1} - the group column display text. In the example above, {1} is a placeholder for food categories (“Seafood”, “Grains and Cereals”, etc.). The {1} placeholder may insert a text string that differs from cell values. This happens when:

  • {2} - the group row summary text. In the example above, the {2} placeholder inserts the value of a summary item that calculates the number of records in each group. The code below creates a group summary item whose value is shown by the {2} placeholder.
gridView.GroupSummary.Add(new GridGroupSummaryItem() {
        FieldName = "UnitPrice",
        SummaryType = SummaryItemType.Count,
        ShowInGroupColumnFooter = null

If you add multiple group row summaries, the {2} placeholder shows comma-separated values for all of them. For example: “Category: Beverage (Count=12),(MAX = 4.50)”.

  • [#image] - the group row image. To specify group row images, assign an ImageComboBox in-place editor (RepositoryItemComboBox) to a group column. Use the GridColumn.ColumnEdit property to specify an in-place editor.

Use the GridView.GetGroupRowDisplayText method to return the currently displayed group row text.

The GroupFormat property affects all group rows in a View. You can also handle the GridView.CustomDrawGroupRow event to modify individual group rows’ captions (for instance, to add HTML tags).

The following code snippets (auto-collected from DevExpress Examples) contain references to the GroupFormat property.


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