Skip to main content

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.

WPF Data Grid - Get Started - Summaries

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

  1. Set the DataViewBase.ShowFixedTotalSummary property to true to show the Fixed Summary Panel.
  2. Create a GridSummaryItem object and add it to the GridControl.TotalSummary collection.
  3. Specify the SummaryItemBase.FieldName and SummaryItemBase.SummaryType properties to apply the summary.
  4. 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

  1. Create a GridSummaryItem object and add it to the GridControl.GroupSummary collection.
  2. Specify the SummaryItemBase.FieldName and SummaryItemBase.SummaryType properties to apply the summary.
  3. 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