GridControl.CustomSummaryExists Event
Enables you to specify which summaries should be calculated and displayed.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v18.2.dll
Declaration
Event Data
The CustomSummaryExists event's data class is CustomSummaryExistEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Exists | Gets or sets whether the summary value should be calculated and displayed. |
GroupLevel | Gets the nesting level of the group whose summary value is being calculated. |
GroupRowHandle | Gets a value identifying the group row whose summary value is about to be calculated. |
IsGroupSummary | Gets whether a group summary value is about to be calculated. |
IsTotalSummary | Gets whether a total summary value is about to be calculated. |
Item | Gets a summary item whose value is about to be calculated. |
Remarks
The event is raised before a particular summary value is calculated, allowing cancellation of the calculation. To cancel summary value calculation, set the event parameter’s CustomSummaryExistEventArgs.Exists parameter to false.
-
In this case, the CustomSummaryExistEventArgs.IsTotalSummary parameter returns true. The processed summary item is returned by the CustomSummaryExistEventArgs.Item property. If required, use the summary item’s properties to identify the column where it is displayed.
-
In this case, the CustomSummaryExistEventArgs.IsGroupSummary parameter returns true. The CustomSummaryExistEventArgs.GroupRowHandle property identifies the group for which the summary value is about to be calculated. The processed group summary item is returned by the CustomSummaryExistEventArgs.Item property.
Note
The CustomSummaryExists event does not work in Server Mode.
Example
This example shows how to calculate group summaries and display them within group rows residing at the top grouping level. A group summary represents a value of the aggregate function calculated over all data rows within a group. Group summary items are stored within the grid's GroupSummary collection.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-display-group-summaries-e1637.
<Window x:Class="DXGrid_DisplayGroupSummaries.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Title="Window1" Height="300" Width="458">
<Grid>
<dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew"
CustomSummaryExists="grid_CustomSummaryExists">
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True"/>
</dxg:GridControl.View>
<dxg:GridControl.GroupSummary>
<dxg:GridSummaryItem FieldName="Age" SummaryType="Min"/>
<dxg:GridSummaryItem FieldName="Age" SummaryType="Max"/>
</dxg:GridControl.GroupSummary>
</dxg:GridControl>
</Grid>
</Window>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomSummaryExists event.
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.