Skip to main content
All docs
V24.2

GridControl.CustomSummaryExistsCommand Property

Gets or sets a command that specifies which summaries should be calculated and displayed.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public ICommand<RowSummaryExistsArgs> CustomSummaryExistsCommand { get; set; }

Property Value

Type Description
ICommand<RowSummaryExistsArgs>

A command that specifies which summaries should be calculated and displayed.

Remarks

Bind a command to the CustomSummaryExistsCommand property to maintain a clean MVVM pattern. The command works like a CustomSummaryExists event handler and allows you to specify whether to calculate a particular summary value in a View Model.

The command bound to the CustomSummaryExistsCommand property is executed before the GridControl calculates a particular summary value. This command allows you to cancel the calculation. To do this, set the RowSummaryExistsArgs.Exists property to false.

For the Total Summary, the RowSummaryExistsArgs.IsTotalSummary parameter returns true. The RowSummaryExistsArgs.SummaryItem property returns the processed summary item. You can use the summary item’s properties to identify the column that displays the summary.

For the Group Summary, the RowSummaryExistsArgs.IsGroupSummary parameter returns true. The RowSummaryExistsArgs.GroupPath property identifies a path to the processed group row. This path contains information about applied group operations. The RowSummaryExistsArgs.SummaryItem property returns the processed group summary item.

Note

The CustomSummaryExistsCommand property does not work in Server Mode.

Example

The following example calculates group summaries only for the top group level:

DevExpress WPF | Grid Control - Custom Summary Exists

View Example: How to Display Group Summaries

<dxg:GridControl x:Name="grid"
                 ItemsSource="{Binding AccountList}"
                 CustomSummaryExistsCommand="{Binding CustomSummaryExistsCommand}">
                 <!-- ... -->
    <dxg:GridControl.GroupSummary>
        <dxg:GridSummaryItem FieldName="Age" SummaryType="Min"/>
        <dxg:GridSummaryItem FieldName="Age" SummaryType="Max"/>
    </dxg:GridControl.GroupSummary>
</dxg:GridControl>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;
// ...
public class MainViewModel : ViewModelBase {
// ...
    [Command]
    public void CustomSummaryExistsCommand(RowSummaryExistsArgs args) {
        args.Exists = args.GroupPath[0].GroupLevel == 0;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomSummaryExistsCommand property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also