Back to Devexpress

GridGroupSummaryItemCollection.Add(SummaryItemType, String) Method

windowsforms-devexpress-dot-xtragrid-dot-gridgroupsummaryitemcollection-dot-add-x28-devexpress-dot-data-dot-summaryitemtype-system-dot-string-x29.md

latest4.8 KB
Original Source

GridGroupSummaryItemCollection.Add(SummaryItemType, String) Method

Adds a new summary item to the current summary collection and initializes its summary type and field name.

Namespace : DevExpress.XtraGrid

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual GridGroupSummaryItem Add(
    SummaryItemType summaryType,
    string fieldName
)
vb
<EditorBrowsable(EditorBrowsableState.Never)>
Public Overridable Function Add(
    summaryType As SummaryItemType,
    fieldName As String
) As GridGroupSummaryItem

Parameters

NameTypeDescription
summaryTypeSummaryItemType

A SummaryItemType value that is the new item’s summary type. This parameter is used to initialize the GridSummaryItem.SummaryType property.

| | fieldName | String |

A string value that is the field’s name used to calculate the summary. This parameter is used to initialize the GridSummaryItem.FieldName property.

|

Returns

TypeDescription
GridGroupSummaryItem

A GridGroupSummaryItem object that is a new summary item added to the collection.

|

Remarks

This method sets the following properties as follows:

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(SummaryItemType, String) method.

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.

winforms-grid-conditionally-hide-summaries-from-group-rows/CS/ConditionallyHideSumsInGroupRows/Form1.cs#L24

csharp
summaryMin = (GridGroupSummaryItem)gridView1.GroupSummary.Add(SummaryItemType.Min, "Unit Price");
summaryMax = (GridGroupSummaryItem)gridView1.GroupSummary.Add(SummaryItemType.Max, "Unit Price");

winforms-grid-conditionally-hide-summaries-from-group-rows/VB/ConditionallyHideSumsInGroupRows/Form1.vb#L25

vb
Dim tmp_XViewsPrinting = New Design.XViewsPrinting(gridControl1)
summaryMin = CType(gridView1.GroupSummary.Add(SummaryItemType.Min, "Unit Price"), GridGroupSummaryItem)
summaryMax = CType(gridView1.GroupSummary.Add(SummaryItemType.Max, "Unit Price"), GridGroupSummaryItem)

See Also

GridGroupSummaryItem

DisplayFormat

Format

SummaryType

ShowInGroupColumnFooter

GridGroupSummaryItemCollection Class

GridGroupSummaryItemCollection Members

DevExpress.XtraGrid Namespace