Version

Band Property (UltraGridChildBand)

Returns the UltraGridBand that the object belongs to, if any. This property is read-only at run-time. This property is not available at design-time.
Syntax
'Declaration
 
Public ReadOnly Property Band As UltraGridBand
public UltraGridBand Band {get;}
Remarks

The Band property of an object refers to a specific band in the grid as defined by an UltraGridBand object. You use the Band property to access the properties of a specified UltraGridBand object, or to return a reference to the UltraGridBand object that is associated with the current object.

UltraGridBand objects are the foundation of the hierarchical data structure used by UltraWinGrid. Any row or cell in the grid must be accessed through its UltraGridBand object. Bands are also used to apply consistent formatting and behavior to the rows that they comprise. An UltraGridBand object is used to display all the data rows from a single level of a data hierarchy. UltraGridBand objects contain multiple sets of child UltraGridRow objects that actually display the data of the recordset. All of the rows that are drawn from a single Command in the DataEnvironment make up a band.

The rows of a band are generally displayed in groups of one more in order to show rows from subsequent bands that are linked to rows in the current band via the structure of the data hierarchy. For example, if a hierarchical recordset has Commands that display Customer, Order and Order Detail data, each one of these Commands maps to its own UltraGridBand in the UltraWinGrid. The rows in the Customer band will appear separated by any Order data rows that exist for the customers. By the same token, rows in the Order band will be appear separated to make room for Order Detail rows. How this looks depends on the ViewStyle settings selected for the grid, but the concept of visual separation is readily apparent when the UltraWinGrid is used with any hierarchical recordset.

Although the rows in a band may appear to be separated, they are treated contiguously. When selecting a column in a band, you will see that the cells of that column become selected in all rows for the band, regardless of any intervening rows. Also, it is possible to collapse the hierarchical display so that any children of the rows in the current band are hidden.

Example
Following code shows you how to traverse through all the rows in the UltraGrid. It finds out the number of regular rows (non-group-by rows) and number of group-by rows and shows the counts.

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

  Private Sub Button40_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button40.Click

      Dim rowsCount As Integer = 0
      Dim groupByRowsCount As Integer = 0

      ' Call the helper method which is a recursive implmentation for traversing rows.
      MessageBox.Show("Please wait. This operation may take a while depending on number of rows.")
      Me.TraverseAllRowsHelper(Me.ultraGrid1.Rows, rowsCount, groupByRowsCount)

      ' Show a dialog showing the number of regular rows and number of group-by rows.
      MessageBox.Show("The UltraGrid has " & rowsCount & " number of regular rows, and " & groupByRowsCount & " number of group-by rows.")

  End Sub

  Private Sub TraverseAllRowsHelper(ByVal rows As RowsCollection, ByRef rowsCount As Integer, ByRef groupByRowsCount As Integer)

      ' Loop through every row in the passed in rows collection.
      Dim row As UltraGridRow = Nothing
      For Each row In rows

          ' If you are using Outlook GroupBy feature and have grouped rows by columns in the
          ' UltraGrid, then rows collection can contain group-by rows or regular rows. So you 
          ' may need to have code to handle group-by rows as well.
          If TypeOf row Is UltraGridGroupByRow Then
              Dim groupByRow As UltraGridGroupByRow = DirectCast(row, UltraGridGroupByRow)
              ' Incremement the group-by row count.
              groupByRowsCount += 1
          Else
              ' Incremenent the regular row count.
              rowsCount += 1
          End If

          ' If the row has any child rows. Typically, there is only a single child band. However,
          ' there will be multiple child bands if the band associated with row1 has mupliple child
          ' bands. This would be the case for exmple when you have a database hierarchy in which a
          ' table has multiple child tables.
          If Not Nothing Is row.ChildBands Then

              ' Loop throgh each of the child bands.
              Dim childBand As UltraGridChildBand = Nothing
              For Each childBand In row.ChildBands
                  ' Call this method recursivedly for each child rows collection.
                  Me.TraverseAllRowsHelper(childBand.Rows, rowsCount, groupByRowsCount)
              Next
          End If

      Next

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

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

	int rowsCount = 0;
	int groupByRowsCount = 0;

	// Call the helper method which is a recursive implmentation for traversing rows.
	MessageBox.Show( "Please wait. This operation may take a while depending on number of rows." );
	this.TraverseAllRowsHelper( this.ultraGrid1.Rows, ref rowsCount, ref groupByRowsCount );

	// Show a dialog showing the number of regular rows and number of group-by rows.
	MessageBox.Show( "The UltraGrid has " + rowsCount + " number of regular rows, and " + groupByRowsCount + " number of group-by rows." );

}
		
private void TraverseAllRowsHelper( RowsCollection rows, ref int rowsCount, ref int groupByRowsCount )
{

	// Loop through every row in the passed in rows collection.
	foreach ( UltraGridRow row in rows )
	{
		// If you are using Outlook GroupBy feature and have grouped rows by columns in the
		// UltraGrid, then rows collection can contain group-by rows or regular rows. So you 
		// may need to have code to handle group-by rows as well.
		if ( row is UltraGridGroupByRow )
		{
			UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)row;

			// Incremement the group-by row count.
			groupByRowsCount++;
		}
		else					
		{
			// Incremenent the regular row count.
			rowsCount++;
		}
		
		// If the row has any child rows. Typically, there is only a single child band. However,
		// there will be multiple child bands if the band associated with row1 has mupliple child
		// bands. This would be the case for exmple when you have a database hierarchy in which a
		// table has multiple child tables.
		if ( null != row.ChildBands )
		{
			// Loop throgh each of the child bands.
			foreach ( UltraGridChildBand childBand in row.ChildBands )
			{
				// Call this method recursivedly for each child rows collection.
				this.TraverseAllRowsHelper( childBand.Rows, ref rowsCount, ref groupByRowsCount );
			}
		}
	}

}
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