SummaryItemBase.FieldName Property

Gets or sets the name of a data source field whose values are used for summary calculation. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v21.1.Core.dll

Declaration

public string FieldName { get; set; }

Property Value

Type Description
String

A String value that specifies the name of the data source field whose values are used for summary calculation.

Example

The following example shows how to calculate group summaries and display them within group rows. A group summary is a value of the aggregate function calculated over all data rows within a group. The GridControl‘s GroupSummary collection stores group summary items.

This example uses the GridControl.CustomSummaryExists event to calculate 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" CustomSummaryExists="OnCustomSummaryExists">
    <dxg:GridControl.View>
        <dxg:TableView AutoWidth="True"/>
    </dxg:GridControl.View>
    <dxg:GridControl.Columns>
        <dxg:GridColumn FieldName="UserName" />
        <dxg:GridColumn FieldName="RegistrationDate" />
        <dxg:GridColumn FieldName="Married" GroupIndex="0" SortOrder="Ascending" />
        <dxg:GridColumn FieldName="Age" />
    </dxg:GridControl.Columns>
    <dxg:GridControl.GroupSummary>
        <dxg:GridSummaryItem FieldName="Age" SummaryType="Min"/>
        <dxg:GridSummaryItem FieldName="Age" SummaryType="Max"/>
    </dxg:GridControl.GroupSummary>
</dxg:GridControl>
void OnCustomSummaryExists(object sender, CustomSummaryExistEventArgs e) {
    e.Exists = e.GroupLevel == 0;
}
See Also