Lesson 4: 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 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
Show Total Summary
Follow the steps below to display the total summary that allows you to display the total number of items:
- Set the DataControlBase.ShowFixedTotalSummary property to true to show the Fixed Summary Panel.
- Create a GridTotalSummaryItem object and add it to the GridControl.TotalSummary collection.
- Set the SummaryItemBase.SummaryType property to Count to apply the summary.
- Set the GridTotalSummaryItem.Alignment property to Right to display the summary on the right side of the Fixed Summary Panel.
<dxg:GridControl ShowFixedTotalSummary="True" ...>
<dxg:GridControl.TotalSummary>
<dxg:GridTotalSummaryItem SummaryType="Count" Alignment="Right"/>
</dxg:GridControl.TotalSummary>
<!-- ... -->
</dxg:GridControl>
Show Group Summary
Follow the steps below to display the group summary that allows you to summarize unit prices in each group:
- Create a GridGroupSummaryItem 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 ...>
<dxg:GridControl.GroupSummary>
<dxg:GridGroupSummaryItem FieldName="UnitPrice" SummaryType="Sum"
DisplayFormat="Sum of Unit Price is {0:c}"/>
</dxg:GridControl.GroupSummary>
<!-- ... -->
</dxg:GridControl>
See Also