Skip to main content
All docs
V24.1

DxTreeListSummaryItem.DisplayText Property

Specifies a display text pattern for the summary item. A display text string can include static text and placeholders for the summary value and the name of a column whose values are summarized.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.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 TreeList 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 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 following code snippet customizes display text of summary items:

Custom summary text

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
        <DxTreeListDataColumn FieldName="Status" Caption="Progress" DisplayFormat="p0" />
    </Columns>
    <TotalSummary>
        <DxTreeListSummaryItem SummaryType="TreeListSummaryItemType.Count" DisplayText="Total Number of Tasks: {0}" FieldName="Name" />
        <DxTreeListSummaryItem SummaryType="TreeListSummaryItemType.Avg" DisplayText="Average {1}: {0}" FieldName="Status" />
    </TotalSummary>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

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

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

See Also