Lesson 5 - Display Summaries
- 2 minutes to read
This tutorial demonstrates how to display summaries for groups of rows (group summary) or individual data columns (total summary). The tutorial is based on Lesson 4.
The GridControl can calculate the following summaries:
- The number of data rows (Count)
- The maximum and minimum values (Max and Min)
- The sum and the average value (Sum and Average)
- Custom summaries
Total Summary
- Set the DataViewBase.ShowFixedTotalSummary property to
true
to show the Fixed Summary Panel. - Create a GridSummaryItem object and add it to the GridControl.TotalSummary collection.
- Specify the SummaryItemBase.FieldName and SummaryItemBase.SummaryType properties to apply the summary.
- Set the SummaryItemBase.Alignment property to
Left
to display the summary on the left side of the Fixed Summary Panel.
<dxg:GridControl.TotalSummary>
<dxg:GridSummaryItem FieldName="OrderId"
SummaryType="Count"
Alignment="Left"/>
</dxg:GridControl.TotalSummary>
<dxg:GridControl.View>
<dxg:TableView ShowFixedTotalSummary="True" ... />
</dxg:GridControl.View>
Group Summary
- Create a GridSummaryItem object and add it to the GridControl.GroupSummary collection.
- Specify the SummaryItemBase.FieldName and SummaryItemBase.SummaryType properties to apply the summary.
- Specify the SummaryItemBase.DisplayFormat property to display the group summary in the currency format.
<dxg:GridControl.GroupSummary>
<dxg:GridSummaryItem FieldName="Freight" SummaryType="Sum"
DisplayFormat="Sum of Freight is {0:c}"/>
</dxg:GridControl.GroupSummary>
Refer to the following help topic for information on how users can create and customize summaries: Edit Summaries.
See Also