GridColumnSummary.DisplayFormat Property

Gets or sets the pattern used to format the summary value. This is a bindable property.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll

Declaration

[XtraSerializableProperty]
public string DisplayFormat { get; set; }
<XtraSerializableProperty>
Public Property DisplayFormat As String

Property Value

Type Description
String

A String value that specifies the pattern used to format the summary value.

Remarks

IMPORTANT

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

Use the DisplayFormat property to format the summary value and add any text to its textual representation. The general pattern is shown below:

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

  • {0} - the summary value's placeholder;
  • format specifier - specifies the formating type (currency, scientific, etc);
  • precision specifier - specifies the number of characters displayed after the decimal point.

For example, to display currency values, set the DisplayFormat property to 'Total: {0:c2}'. If the summary value is 123, its formatted equivalent will be 'Total: $123.00'.

When the format string is not specified for a summary, default formats are used. The following table displays the default format of each summary type for a total and group summary.

Summary Type Total Summary Format Group Summary Format
Average AVG={0:columnDisplayFormat} summaryFieldName: AVG={0:columnDisplayFormat}
Count {0} {0}
Min MIN={0:columnDisplayFormat} summaryFieldName: MIN={0:columnDisplayFormat}
Max MAX={0:columnDisplayFormat} summaryFieldName: MAX={0:columnDisplayFormat}
Sum SUM={0:columnDisplayFormat} summaryFieldName: SUM={0:columnDisplayFormat}

Examples

This example shows how to calculate group and total summaries for grid columns using predefined aggregate functions or a custom rule.

The following data summaries are created.

  • Group summary to display the maximum value in a Total column for each group of records.
  • Total summary to calculate the sum of values by the whole Total column.
  • Custom total summary to count the number of rows whose value in the Shipped column is false.

Grid_GettingStarted_Lesson5_Result_iOS

Grid_GettingStarted_Lesson5_Result_Android_Dark

void OnCalculateCustomSummary(object sender, CustomSummaryEventArgs e) {
    if (e.FieldName.ToString () == "Shipped")
    if (e.IsTotalSummary){
        if (e.SummaryProcess == CustomSummaryProcess.Start) {
            count = 0;
        }
        if (e.SummaryProcess == CustomSummaryProcess.Calculate) {
            if (!(bool)e.FieldValue)
                count++;
            e.TotalValue = count;
        }
    }
}
See Also