Skip to main content
A newer version of this page is available. .

GridSummaryItem.DisplayFormat Property

Gets or sets the display format rule for the GridSummaryItem value. An empty string to apply the default format rule.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v18.2.dll

Declaration

[DefaultValue("")]
[XtraSerializableProperty(100)]
public string DisplayFormat { get; set; }

Property Value

Type Default Description
String String.Empty

A string that specifies the display format rule for the GridSummaryItem.

Remarks

The display format rule syntax is:

<custom text>{0<:format specifier<precision specifier>>}<custom text>

  • custom text - any custom string displayed before and after the summary value.
  • ‘{0}’ - the placeholder for the summary value.
  • format specifier - specifies the summary value format.
  • precision specifier - the number of digits after the decimal point.

The Create total and group summaries demo illustrates how to apply display format rules to total and group summary items.

GridSummaryItem_DisplayFormat


gridView.OptionsView.ShowFooter = true;
gridView.Columns["Mark"].Group();

// Creating total and group summaries
GridColumn column = gridView.Columns["Length"];
column.SummaryItem.SummaryType = SummaryItemType.Sum;
// format the total summary
column.SummaryItem.DisplayFormat = "Total: {0:n3}";
// group summary
gridView.GroupSummary.Add(SummaryItemType.Count, "Mark");

gridView.GroupSummary.Add(new GridGroupSummaryItem()
{
    FieldName = "Length",
    SummaryType = SummaryItemType.Sum,
    DisplayFormat = "Sum: {0:n5}",
    ShowInGroupColumnFooter = gridView.Columns["Length"]
});

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayFormat 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