'宣言 Public ReadOnly Property ParentBand As UltraGridBand
public UltraGridBand ParentBand {get;}
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" ); } } }