バージョン

HasChild(Boolean) メソッド

行に子の行があるかどうかを示すブール式を返します。
シンタックス
'宣言
 
Public Overloads Function HasChild( _
   ByVal excludeHidden As Boolean _
) As Boolean
public bool HasChild( 
   bool excludeHidden
)

パラメータ

excludeHidden
True の場合、表示可能な行だけを探します。

戻り値の型

行に子行がある場合 True。
解説

行に少なくともひとつの子の行があるかどうかを決定するためにこのメソッドを呼び出します。子の行が存在する場合、このメソッドは True を返します。そうでなければ、このメソッドは False を返します。

band 引数を使用すれば、子行を探す子バンドを指定できます。band が指定されない場合、このメソッドはすべての子バンドから子行を探します。

先頭および最後の子行への参照は、GetChild メソッドを呼び出して返すことができます。

HasParentHasNextSibling、およびHasPrevSibling メソッドは、行に親行を持ち、行の上下に兄弟行を持つかどうかをそれぞれ決定するために呼び出すことができます。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub TraverseAllRowsHelper(ByVal startRow As UltraGridRow, ByRef rowsCount As Integer, ByRef groupByRowsCount As Integer)

      Dim row As UltraGridRow = startRow

      While Not row Is Nothing
          If TypeOf row Is UltraGridGroupByRow Then
              ' Write code here to process the group by row.
              groupByRowsCount += 1
          Else
              ' Write code here to process the regular by row.
              rowsCount += 1
          End If

          ' If the row has any child rows, then process them too.
          If row.HasChild(False) Then
              Me.TraverseAllRowsHelper(row.GetChild(ChildRow.First), rowsCount, groupByRowsCount)
          End If

          row = row.GetSibling(SiblingRow.Next, True, False)
      End While

  End Sub

  Private Sub Button71_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button71.Click

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

      ' Get the first row in the UltraGrid.
      Dim firstRow As UltraGridRow = Me.ultraGrid1.GetRow(ChildRow.First)

      ' 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(firstRow, 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
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void TraverseAllRowsHelper( UltraGridRow startRow, ref int rowsCount, ref int groupByRowsCount )
{

	UltraGridRow row = startRow;

	while ( null != row )
	{				
		if ( row is UltraGridGroupByRow )
		{
			// Write code here to process the group by row.
			groupByRowsCount++;
		}
		else
		{
			// Write code here to process the regular by row.
			rowsCount++;
		}

		// If the row has any child rows, then process them too.
		if ( row.HasChild( false ) )
		{
			this.TraverseAllRowsHelper( row.GetChild( ChildRow.First ), ref rowsCount, ref groupByRowsCount );
		}

		row = row.GetSibling( SiblingRow.Next, true, false );
	}

}

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

	int rowsCount = 0;
	int groupByRowsCount = 0;

	// Get the first row in the UltraGrid.
	UltraGridRow firstRow = this.ultraGrid1.GetRow( ChildRow.First );

	// 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( firstRow, 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." );

}
参照