windowsforms-devexpress-dot-xtragrid-dot-gridsummaryitem-f195e12e.md
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.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DefaultValue("")]
[DXCategory("Format")]
[XtraSerializableProperty(100)]
public string DisplayFormat { get; set; }
<DefaultValue("")>
<XtraSerializableProperty(100)>
<DXCategory("Format")>
Public Property DisplayFormat As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A string that specifies the display format rule for the GridSummaryItem.
|
The display format rule syntax is:
<custom text>{0<:format specifier<precision specifier>>}<custom text>
The Create total and group summaries demo illustrates how to apply display format rules to total and group summary items.
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"]
});
gridView.OptionsView.ShowFooter = True
gridView.Columns("Mark").Group()
' Creating total and group summaries
Dim column As GridColumn = 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() With {.FieldName = "Length", .SummaryType = SummaryItemType.Sum, .DisplayFormat = "Sum: {0:n5}", .ShowInGroupColumnFooter = gridView.Columns("Length")})
See Also