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

Enum for specifying whether to allow row summaries at override level as well as individual column level.

Syntax

Visual Basic (Declaration) 
Public Enum AllowRowSummaries 
   Inherits System.Enum
C# 
public enum AllowRowSummaries : System.Enum 

Members

MemberDescription
BasedOnDataType Base it on the column's data type.
Default Default.
False Do not allow row summaries.
SingleSummaryBehaves like True however allows the user to select only a single summary per column.
SingleSummaryBasedOnDataTypeBehaves like BasedOnDataType however allows the user to select only a single summary per column.
True Allow row summaries.

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 enum is used for specifying the Override's UltraGridOverride.AllowRowSummaries and Column's UltraGridColumn.AllowRowSummaries properties.

See Also