Version

Add(String,SummaryType,UltraGridColumn,SummaryPosition) Method

Adds a new SummarySettings object created using the supplied arguments and returns that new summary settings object.
Syntax
'Declaration
 
Public Overloads Function Add( _
   ByVal key As String, _
   ByVal summaryType As SummaryType, _
   ByVal sourceColumn As UltraGridColumn, _
   ByVal summaryPosition As SummaryPosition _
) As SummarySettings

Parameters

key
A value that uniquely identifies an object in a collection.
summaryType
SummaryType. With this overload, you must specify a non-Custom sumary type. Use a different overload for specifying custom summaries.
sourceColumn
Field that will be summarized.
summaryPosition
Specifies the place where the summary will be displayed in the grid.

Return Value

The new SummarySettings object that was created and added to the collection with supplied arguments.
Remarks

Creates a new SummarySettings object based on the passed in arguments and adds it to the collection.

If summaryType is SummaryType.Custom, then this overload will throw an exception. Use an overload that takes in an ICustomSummaryCalculator argument for specifying custom summaries.

SourceColumn is the column whose data is being summarized. The sourceColumn must be from the band associated with this SummarySettingsCollection or from one of the descendant bands.

If summaryPosition is SummaryPosition.UseSummaryPositionColumn, then it will be displayed under the source column.

Example
Following code illustrates how to programatically add summaries in code. It adds a Count summary for CusomerID column for displaying number of records on the bottom of every rows collection in band 1.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button13_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button13.Click

      Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(1)

      ' Add a summary.
      Dim summary As SummarySettings = band.Summaries.Add(SummaryType.Count, band.Columns("CustomerID"))

      ' Set the summary position to Left so that it shows up on the left of the
      ' summary footer area.
      summary.SummaryPosition = SummaryPosition.Left

      ' Set the format with which to format the calculated summary when displaying
      ' in the summary footer.
      summary.DisplayFormat = "Record Count = {0:#####}"

      ' Set the appearance of the summary.
      summary.Appearance.TextHAlign = HAlign.Left
      summary.Appearance.ForeColor = Color.DarkBlue
      summary.Appearance.BackColor = Color.White

      ' Set the border style of summaries to desired value.
      band.Override.BorderStyleSummaryValue = UIElementBorderStyle.None

      ' Set the appearance of summary footer and the footer caption.
      band.Override.SummaryFooterAppearance.BackColor = Color.White
      band.Override.SummaryFooterCaptionAppearance.BackColor = Color.White

      ' Set the text that shows up in the caption of the summary footer.
      ' You can use column names in square brackets like (CustomerID) below.
      band.SummaryFooterCaption = "Customer ID: (CustomerID)"

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button13_Click(object sender, System.EventArgs e)
{

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[1];
	
	// Add a summary.
	SummarySettings summary = band.Summaries.Add( SummaryType.Count, band.Columns["CustomerID"] );			
	
	// Set the summary position to Left so that it shows up on the left of the
	// summary footer area.
	summary.SummaryPosition = SummaryPosition.Left;
	
	// Set the format with which to format the calculated summary when displaying
	// in the summary footer.
	summary.DisplayFormat = "Record Count = {0:#####}";
			
	// Set the appearance of the summary.
	summary.Appearance.TextHAlign = HAlign.Left;
	summary.Appearance.ForeColor = Color.DarkBlue;
	summary.Appearance.BackColor = Color.White;

	// Set the border style of summaries to desired value.
	band.Override.BorderStyleSummaryValue = UIElementBorderStyle.None;

	// Set the appearance of summary footer and the footer caption.
	band.Override.SummaryFooterAppearance.BackColor = Color.White;
	band.Override.SummaryFooterCaptionAppearance.BackColor = Color.White;

	// Set the text that shows up in the caption of the summary footer.
	// You can use column names in square brackets like [CustomerID] below.
	band.SummaryFooterCaption = "Customer ID: [CustomerID]";

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also