Grouping with WPF GridDataControl

With the Vol. 3 release, the much awaited grouping and summaries support for the WPF grid will be out. This support works with the CollectionView grouping mode. The summaries are not a part of CollectionView grouping logic, so we included high-level functions that will calculate the summaries of a group dynamically using LINQ methods. This only has the constraint of using IEnumerable<T> implemented data sources.

Interactive grouping


Considering you have the GridDataControl added in the XAML markup, just adding the following code snippet would let you define grouped columns.


    <syncfusion:GridDataGroupColumn ColumnName="ShipCountry"/>


Defining Summaries

There are three different types of summaries present in GDC:

  • Table Summary
  • Group Summary
  • Group Caption Summary

All of these have the same syntax to declare. You also have the option of seeing what kind of summary the end-user would prefer.



XAML code snippet:

Table Summary

    <syncfusion:GridDataSummaryRow ShowSummaryInRow="True" Title="Total Freight: {FreightSummary} For {CountSummary} Items" TitleColumnCount="2">
            <syncfusion:GridDataSummaryColumn Name="FreightSummary" MappingName="Freight" SummaryType="Int32Aggregate" Format="'{Sum:c}'" />
            <syncfusion:GridDataSummaryColumn Name="CountSummary" MappingName="OrderDate" SummaryType="CountAggregate" Format="'{Count:d}'" />

Group Summary

    <syncfusion:GridDataSummaryRow ShowSummaryInRow="True" Title="'Charges - {FreightSummary} for {OrderCount} Items'">
            <syncfusion:GridDataSummaryColumn Name="FreightSummary"  MappingName="Freight" SummaryType="Int32Aggregate" Format="'{Sum:c}'" />
            <syncfusion:GridDataSummaryColumn Name="OrderCount" MappingName="OrderDate" SummaryType="CountAggregate" Format="'{Count}'" />

Group Caption Summary

    <syncfusion:GridDataSummaryRow ShowSummaryInRow="False" Title="'{Count} Items'" TitleColumnCount="2">
            <syncfusion:GridDataSummaryColumn Name="FreightSummary"  MappingName="Freight" SummaryType="Int32Aggregate" Format="'{Sum:##}'" > 

You may notice that each GridDataSummaryColumn has a Format property. This property specifies the value of the Summary and replaces it with a string that gets formatted. The below values are present for different summary types,


  • Count


  • Count
  • Max
  • Min
  • Sum
  • Average

We can also add custom summaries and plug into the grid, but that needs a separate post to explain the workflow.


  • Sathya
    Apr 26, 2017

    Test comment. Please ignore.

Leave a comment