Share on twitter
Share on facebook
Share on linkedin
Summary calculation of selected rows in WPF DataGrid

Introducing Summary Calculation Support for Selected Rows in WPF DataGrid

We are happy to announce that in our Essential Studio 2019 Volume 4 release, we added summary calculation support for selected rows in the WPF DataGrid control. This blog provides a walk-through of how to calculate summaries for selected rows and how to use the available options.

The DataGrid allows users to calculate summaries for:

  • Selected rows.
  • All rows.
  • All rows until rows are selected.

The SummaryCalculationUnit enumeration is used to perform these operations.

To calculate a summary of selected rows in the DataGrid, set the SfDataGrid.SummaryCalculationUnit property to SelectedRows.

In the following example, a summary is calculated for group caption summary rows. This summary calculation support is also applicable for both group and table summary rows.

<syncfusion:SfDataGrid x:Name="sfDataGrid"                
                       ItemsSource="{Binding YearlySalesDetails}"

Summary Calculation of Selected Rows in WPF DataGridA summary row can also be considered while calculating the summary.

    <syncfusion:GridSummaryRow Title="Total Sales in Year for selected products: {YearSales}" CalculationUnit="SelectedRows" ShowSummaryInRow="True">
            <syncfusion:GridSummaryColumn Name="YearSales"
                                          SummaryType="DoubleAggregate" />
            <syncfusion:GridSummaryColumn Name="ProductCount"
                                          SummaryType="CountAggregate" />

Summary calculation for selected rows with summary in WPF DataGridHere, let’s use the value for the property SummaryCalculationUnit of DataGrid to calculate a summary of the selected rows; otherwise, the summary for all rows will be calculated.

I hope you now understand this feature and how to calculate summaries for selected rows in the WPF DataGrid. You can download a demo of calculating summaries for selected rows from our GitHub samples. To learn more about the summaries in the Syncfusion DataGrid, please refer to our documentation. You can download our 2019 Volume 4 release to check out all our new features and controls.

If you have any questions or require clarification for this control, please let us know in the comments section. You can also contact us through our support forumDirect-Trac, or feedback portal. We are happy to assist you!


Share this post:

Share on twitter
Share on facebook
Share on linkedin

Leave a comment

Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top