A newer version of this page is available. Switch to the current version.

SummaryItemBase.SummaryType Property

Gets or sets the aggregate function type. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v18.2.Core.dll

Declaration

public SummaryItemType SummaryType { get; set; }

Property Value

Type Description
SummaryItemType

A SummaryItemType enumeration value that specifies the aggregate function type.

Available values:

Name Description
Sum

The sum of all values in a column.

Min

The minimum value in a column.

Max

The maximum value in a column.

Count

The record count.

Average

The average value of a column.

Custom

Specifies whether calculations should be performed manually using a specially designed event.

None

Disables summary value calculation.

Remarks

There are five predefined aggregate functions. These are: Sum, Min, Max, Average and Count. To implement your own aggregate function, set the SummaryType property to SummaryItemType.Custom, and handle the GridControl.CustomSummary event.

Average and Sum summaries are only calculated for columns that contain numerical data.

Examples

The following example demonstrates how to use custom summaries to count the total number of empty cells in the specified grid column.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-summarize-empty-cells-e948.

<Window x:Class="CustomSummary_EmptyCells.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
    Title="Window1" Height="350" Width="450" >
    <Grid>
        <dxg:GridControl x:Name="grid" CustomSummary="grid_CustomSummary" GroupCount="1">
            <dxg:GridControl.SortInfo>
                <dxg:GridSortInfo FieldName="Text" />
            </dxg:GridControl.SortInfo>
            <dxg:GridControl.Columns>
                <dxg:GridColumn FieldName="Text" />
                <dxg:GridColumn FieldName="Number" />
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:TableView x:Name="view" AutoWidth="True" 
                                    NavigationStyle="Cell" ShowTotalSummary="True"/>
            </dxg:GridControl.View>
            <dxg:GridControl.TotalSummary>
                <dxg:GridSummaryItem FieldName="Number" SummaryType="Custom" 
                                    DisplayFormat="Total empty cells count: {0}"/>
            </dxg:GridControl.TotalSummary>
            <dxg:GridControl.GroupSummary>
                <dxg:GridSummaryItem FieldName="Number" SummaryType="Custom" 
                                    DisplayFormat="Group empty cells count: {0}"/>
            </dxg:GridControl.GroupSummary>
        </dxg:GridControl>
    </Grid>
</Window>
See Also