Skip to main content
All docs
V24.2

DxGridSummaryItem.DisplayText Property

Specifies display text pattern for the summary item. A display text string can include static text and placeholders for summary value and column caption.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public string DisplayText { get; set; }

Property Value

Type Default Description
String null

The summary item’s display text pattern.

Remarks

The Grid creates display text for a summary item based on the following predefined display formats:

<aggregate function>: <summary value>
For the Count summary and summaries that are shown in a footer of the same column where the values are calculated.
Example: Max: 130
<aggregate function> of <column caption>: <summary value>
For summaries that are shown in group rows or in a footer of another column.
Example: Max of Quantity: 130

A summary value’s format pattern matches the corresponding column’s DisplayFormat. Use the summary item’s ValueDisplayFormat property to change the value format.

A summary item’s display text string can include static text and the following placeholders:

  • {0} - A string that is the summary value with the format pattern applied.
  • {1} - The caption of the column that supplies values for summary calculation. The placeholder returns an empty string if the summary item’s FieldName property is unset.

The following code snippet customizes display text of group and total summary items:

Custom summary text

<DxGrid Data="@Data" ShowGroupPanel="true">
    <Columns>
        <DxGridDataColumn FieldName="OrderDate" GroupIndex="0" />
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Caption="Price"/>
        <DxGridDataColumn FieldName="Quantity" />
        <DxGridDataColumn FieldName="Total" UnboundType="GridUnboundColumnType.Decimal"
                          UnboundExpression="[UnitPrice] * [Quantity]" DisplayFormat="c"/>
    </Columns>
    <GroupSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" FieldName="Total" FooterColumnName="Total"
                           DisplayText="{0}" />
    </GroupSummary>
    <TotalSummary>
        <DxGridSummaryItem FieldName="Total" SummaryType="GridSummaryItemType.Min"
                           DisplayText="The cheapest Order is {0}" />
        <DxGridSummaryItem FieldName="UnitPrice" SummaryType="GridSummaryItemType.Avg"
                           DisplayText="The average {1} is {0}" />
    </TotalSummary>
</DxGrid>

To customize display text for an individual calculated summary value, handle the CustomizeSummaryDisplayText event. The Grid event argument allows you to obtain information about the Grid’s current state and add this information to a summary item’s display text.

For more information about summaries in the Grid component, refer to the following topic: Summary in Blazor Grid.

Implements

See Also