Infragistics(R) NetAdvantage(R) Windows Forms
AllowRowSummaries Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridOverride Class : AllowRowSummaries Property

Enables the user interface that lets the user add or remove column summaries. By default the functionality is disabled. Default is resolved to False.

Syntax

Visual Basic (Declaration) 
Public Property AllowRowSummaries As AllowRowSummaries
C# 
public AllowRowSummaries AllowRowSummaries {get; set;}

Example

Following code shows how to use row summaries feature in the UltraGrid. It summarizes UnitPrice column in band 2. It adds summaries to find Maximum and Average for UnitPrice column.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button15_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button15.Click

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

      ' Set the AllowRowSummaries to either True or BasedOnDataType to allow
      ' the user to be able to add, remove or modify summaries. This is not 
      ' necessary to create summaries programmatically and only effects the 
      ' users ability to create, remove or modify summaries.
      band.Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType

      ' You can also prevent the user from adding, removing or modifying a
      ' summary on a column basis. Prevent the user from summarizing OrderID 
      ' column.
      band.Columns("OrderID").AllowRowSummaries = AllowRowSummaries.False
      band.Columns("ProductID").AllowRowSummaries = AllowRowSummaries.False

      ' Add summaries. Notice the keys "Max" and "Avg". We will use them to
      ' identify the summaries later on for example in SummaryValueChanged
      ' event.
      Dim maxSummary As SummarySettings = band.Summaries.Add("Max", SummaryType.Maximum, band.Columns("Unit Price"))
      Dim avgSummary As SummarySettings = band.Summaries.Add("Avg", SummaryType.Average, band.Columns("Unit Price"))

      ' Set the format of the summary text
      maxSummary.DisplayFormat = "Min = {0:#####.00}"
      avgSummary.DisplayFormat = "Avg = {0:#####.00}"

      ' Change the appearance settings for summaries.
      maxSummary.Appearance.TextHAlign = HAlign.Right
      avgSummary.Appearance.TextHAlign = HAlign.Right

      ' Set the DisplayInGroupBy property of both summaries to false so they don't
      ' show up in group-by rows.
      maxSummary.DisplayInGroupBy = False
      avgSummary.DisplayInGroupBy = False

      ' Set the caption that shows up on the header of the summary footer.
      band.SummaryFooterCaption = "Summary of Unit Price"
      band.Override.SummaryFooterCaptionAppearance.FontData.Bold = DefaultableBoolean.True
      band.Override.SummaryFooterCaptionAppearance.BackColor = Color.DarkBlue
      band.Override.SummaryFooterCaptionAppearance.ForeColor = Color.LightYellow

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

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

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[2];

	// Set the AllowRowSummaries to either True or BasedOnDataType to allow
	// the user to be able to add, remove or modify summaries. This is not 
	// necessary to create summaries programmatically and only effects the 
	// users ability to create, remove or modify summaries.
	band.Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType;

	// You can also prevent the user from adding, removing or modifying a
	// summary on a column basis. Prevent the user from summarizing OrderID 
	// column.
	band.Columns["OrderID"].AllowRowSummaries = AllowRowSummaries.False;
	band.Columns["ProductID"].AllowRowSummaries = AllowRowSummaries.False;
	
	// Add summaries. Notice the keys "Max" and "Avg". We will use them to
	// identify the summaries later on for example in SummaryValueChanged
	// event.
	SummarySettings maxSummary = band.Summaries.Add( "Max", SummaryType.Maximum, band.Columns["Unit Price"] );
	SummarySettings avgSummary = band.Summaries.Add( "Avg", SummaryType.Average, band.Columns["Unit Price"] );

	// Set the format of the summary text
	maxSummary.DisplayFormat = "Min = {0:#####.00}";
	avgSummary.DisplayFormat = "Avg = {0:#####.00}";

	// Change the appearance settings for summaries.
	maxSummary.Appearance.TextHAlign = HAlign.Right;
	avgSummary.Appearance.TextHAlign = HAlign.Right;			

	// Set the DisplayInGroupBy property of both summaries to false so they don't
	// show up in group-by rows.
	maxSummary.DisplayInGroupBy = false;
	avgSummary.DisplayInGroupBy = false;

	// Set the caption that shows up on the header of the summary footer.
	band.SummaryFooterCaption = "Summary of Unit Price";
	band.Override.SummaryFooterCaptionAppearance.FontData.Bold = DefaultableBoolean.True;
	band.Override.SummaryFooterCaptionAppearance.BackColor = Color.DarkBlue;
	band.Override.SummaryFooterCaptionAppearance.ForeColor = Color.LightYellow;

}

Remarks

AllowRowSummaries property determines whether the user will be allowed to add or remove row summaries. Enabling the row summaries will display a button in each column header that the user can use to summarize the column. By default the row summaries are disabled.

Note that this property controls whether the user interface for changing the summaries is enabled. It does not control whether you can display summaries or not. You can still display the summaries by adding them to the Infragistics.Win.UltraWinGrid.UltraGridBand.Summaries collection. You can add summaries in code using the Infragistics.Win.UltraWinGrid.SummarySettingsCollection.Add method of the SummarySettingsCollection object.

See Also