Version

Index Property (UltraGridBand)

Number that specifies the band's position in the Bands collection..
Syntax
'Declaration
 
Public ReadOnly Property Index As Integer
public int Index {get;}
Remarks

The Index property is set by default to the order of the creation of objects in a collection. The index for the first object in a collection will always be zero.

The value of the Index property of an object can change when objects in the collection are reordered, such as when objects are added to or deleted from the collection. Since the Index property may change dynamically, it may be more useful to refer to objects in a collection by using its Key property.

Not all objects in a collection support an Index property. For certain objects, the Index value is essentially meaningless except as an internal placeholder within the collection. In these cases, the object will not have an Index property, even though it is in a collection. You can use other mechanisms, such as the Key property or the For Each... loop structure, to access the objects in the collection.

Example
Following code illustrates ParentBand and ParentColumn properties and how they are related. UltraGridBand.ParentBand property returns the parent band of a band. It applies to child bands only since the top-most band (band with the index of 0) doesn't have any parent band. ParentColumn works in the same manner (that is the top-most band doesn't have a parent column) but it returns an UltraGridColumn object. A parent column of a child band associates the child band to its parent. Thus if a band has multiple child bands, then the parent column of each of the child bands will be different. These parent columns are also contained in the columns collection (collection returned by UltraGridBand.Columns property) of the parent band. Also these parent columns are chaptered (IsChaptered property off the columnn returns true).

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button141_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button141.Click

       ' Loop through all the bands.
       Dim band As UltraGridBand = Nothing
       For Each band In Me.ultraGrid1.DisplayLayout.Bands

           Dim parentBand As UltraGridBand = band.ParentBand
           Dim parentColumn As UltraGridColumn = band.ParentColumn

           If Not parentBand Is Nothing Then
               Debug.Write("bands(" & band.Index & ") key = " & band.Key)
               Debug.Write(", ParentBand.Key = " & parentBand.Key)
               Debug.WriteLine(", ParentColumn.Key = " & parentColumn.Key)

               ' IsChaptered property off the parent columns is always true.
               Debug.Assert(parentColumn.IsChaptered, "ParentColumn.IsChaptered should always be true.")

               ' Also the parent column of child bands is containes in the parent band's columns 
               ' collection.
               Dim col As UltraGridColumn = parentBand.Columns(parentColumn.Index)
               Debug.Assert(col Is parentColumn)
           Else
               ' If parent band is null, then the parent column should also be null.
               Debug.Assert(parentColumn Is Nothing)

               Debug.Write("bands(" & band.Index & ") key = " & band.Key)
               Debug.WriteLine(", ParentBand = Nothing, ParentColumn = Nothing")
           End If

       Next

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

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

	// Loop through all the bands.
	foreach ( UltraGridBand band in this.ultraGrid1.DisplayLayout.Bands )
	{
		UltraGridBand parentBand = band.ParentBand;
		UltraGridColumn parentColumn = band.ParentColumn;

		if ( null != parentBand )
		{
			Debug.Write( "bands[" + band.Index + "] key = " + band.Key );
			Debug.Write( ", ParentBand.Key = " + parentBand.Key );
			Debug.WriteLine( ", ParentColumn.Key = " + parentColumn.Key );

			// IsChaptered property off the parent columns is always true.
			Debug.Assert( parentColumn.IsChaptered, "ParentColumn.IsChaptered should always be true." );
		
			// Also the parent column of child bands is containes in the parent band's columns 
			// collection.
			UltraGridColumn col = parentBand.Columns[ parentColumn.Index ];
			Debug.Assert( col == parentColumn );
		}
		else
		{
			// If parent band is null, then the parent column should also be null.
			Debug.Assert( null == parentColumn );

			Debug.Write( "bands[" + band.Index + "] key = " + band.Key );
			Debug.WriteLine( ", ParentBand = null, ParentColumn = null" );
		}
	}

}
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