Grid grouping and totals

Hi!

I need support with SfDataGrid grouping and summarizing.

I have this xaml code

Snippet
<syncfusion:SfDataGrid AutoGenerateColumns="True" ItemsSource="{Binding DemoData}" Grid.Row="1">
            <syncfusion:SfDataGrid.GroupColumnDescriptions>
                <syncfusion:GroupColumnDescription ColumnName="Tax.Group" />
            syncfusion:SfDataGrid.GroupColumnDescriptions>
 
            <syncfusion:SfDataGrid.GroupSummaryRows>
                <syncfusion:GridSummaryRow ShowSummaryInRow="False">
                    <syncfusion:GridSummaryRow.SummaryColumns>
                        <syncfusion:GridSummaryColumn Name="Amount"
                                              Format="'{Sum}'"
                                              MappingName="Amount"
                                              SummaryType="DoubleAggregate" />
 
                        <syncfusion:GridSummaryColumn Name="Credit"
                                              Format="'{Sum}'"
                                              MappingName="Credit"
                                              SummaryType="DoubleAggregate" />
 
 
                        <syncfusion:GridSummaryColumn Name="Debt"
                                              Format="'{Sum}'"
                                              MappingName="Debt"
                                              SummaryType="DoubleAggregate" />
                    syncfusion:GridSummaryRow.SummaryColumns>
                syncfusion:GridSummaryRow>
            syncfusion:SfDataGrid.GroupSummaryRows>
        syncfusion:SfDataGrid>

The grid itemssource is a list of Detail

In the Format proeprty of GridSymmaryColumn i tried "'{Sum:d}'" and "'{Sum}'".

And this classes definition

Snippet
public class Detail {
   
       public decimal Amount { get => AmountGet(); }
 
       public decimal Credit { get; set; } = 0;
 
       public decimal Debt { get; set; } = 0;
 
       public Tax Tax { get; set; } = null;

}

Snippet
public class Tax {
  
       #region Properties
 
       public string Description { get; set; } = null;
 
       public string Group { get; set; } = null;
 
       public string Id { get; set; } = null;
 
       #endregion Properties
 
   }


In the grid i need to show on the group row the totals (Tax.Group, sum of Amount, sum of Credit and sum of Debt) and a nested grid with the list of detail (all columns).

How can you see in the attached image i don't see any totalImg.png


How can i do?


Thanks


1 Reply

VS Vijayarasan Sivanandham Syncfusion Team May 30, 2022 05:01 PM UTC

Hi Luca,

We have prepared the sample based on a provided code snippet from our end. Please find the sample in the attachment.

UG Link: https://help.syncfusion.com/wpf/datagrid/summaries#group-summary

Please have a look at this sample and let us know if you have any concerns in this.

Regards,
Vijayarasan S


Attachment: Sample_7916bac8.zip

Loader.
Up arrow icon