This example illustrates how to define summary rows using AttachedProperty in WPF DataGrid (SfDataGrid).
WPF DataGrid (SfDataGrid) provides support to show the column summary. If the DataContext of SfDataGrid is ViewModel, you can bind SummaryColumns to a property in ViewModel using the AttachedProperty of type List<GridSummaryColumn>.
Refer to the code example in the following KB article to define an AttachedProperty of type List<GridSummaryColumn>.
KB article - How to define summary rows using AttachedProperty in WPF and UWP DataGrid (SfDataGrid)