バージョン 24.2 (最新)

InitializeRow イベント (UltraGrid)

行が初期化されるときに発生します。
シンタックス
public event InitializeRowEventHandler InitializeRow
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、InitializeRowEventArgs 型の引数を受け取りました。次の InitializeRowEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
ReInitialize 行がすでに初期化されている場合、Trueを返します。
Row 初期化されている行を返します。
解説

InitializeRowEventArgs.Row 引数は、表示される行でプロパティを設定でき、メソッドを呼び出す UltraGridRow オブジェクトへの参照を返します。この参照を使用して、返された行のプロパティを設定したり、メソッドを呼び出したりすることができます。

InitializeRowEventArgs.ReInitialize 引数を使用すると、行が初めて初期化されるのか (UltraDropDown が最初にデータをロードするときなど) 、または再初期化されるか (RowsCollection.Refresh メソッドが呼び出されたときなど) を確認できます。

このイベントは、アンバウンド セルの移植や値に基づくセルの色の変更などの作成された後に行のアクションを実行する機会を提供します。

InitializeRow イベントの発生トリガー:

- 各行が最初に作成された後に 1 回発生します。この場合、e.ReInitialize は False です。

- 各行で各セル値の変更 (バインドまたは非バインド)。この場合、e.ReInitialize は True です。注: セル値がイベント ハンドラーでのロジックによって変更される場合、このイベントは再帰的に発生されません。

- WinGrid の Rows.Refresh メソッドが FireInitializeRow パラメーターと呼び出されたときに、各行のために 1 回発生されます。この場合、e.ReInitialize は True です。

注: グリッドを印刷またはエクスポートする場合、行がクローンされます。クローンされた各行に InitializeRow が e.ReInitialize = False と発生します。

UltraGridBase.DisplayLayout オブジェクトの UltraGridLayout.ViewStyle および UltraGridLayout.ViewStyleBand のプロパティは、このイベント プロシージャーでは読み取り専用です。

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

   Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ultraGrid1.InitializeRow

       ' ReInitialize indicates whether the row is being initialized for the first time
       ' or it's being re-initialized.
       If e.ReInitialize Then
           Debug.WriteLine("A row is being re-initilaized.")
       Else
           Debug.WriteLine("A row is being initilaized.")
       End If

       Dim band As UltraGridBand = Me.ultraGrid1.DisplayLayout.Bands(0)

       ' Check to see if the row is from band 0.
       '
       If e.Row.Band Is Me.ultraGrid1.DisplayLayout.Bands(0) Then
           ' Create a custom description that we want shown in the row's
           ' row preview area.
           Dim description As System.Text.StringBuilder = New System.Text.StringBuilder()

           description.Append(e.Row.GetCellText(band.Columns("ContactName")))
           description.Append(vbCrLf)
           description.Append(e.Row.GetCellText(band.Columns("City")))
           description.Append(", ")
           description.Append(e.Row.GetCellText(band.Columns("Country")))

           ' Set the row's Description to our custom description text.
           e.Row.Description = description.ToString()
       End If

   End Sub
'宣言
 
Public Event InitializeRow As InitializeRowEventHandler
 
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{

	// ReInitialize indicates whether the row is being initialized for the first time
	// or it's being re-initialized.
	if ( e.ReInitialize )
		Debug.WriteLine( "A row is being re-initilaized." );
	else
		Debug.WriteLine( "A row is being initilaized." );

	UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
	 
	// Check to see if the row is from band 0.
	//
	if ( e.Row.Band == this.ultraGrid1.DisplayLayout.Bands[0] )
	{
		// Create a custom description that we want shown in the row's
		// row preview area.
		System.Text.StringBuilder description = new System.Text.StringBuilder( );
	 
		description.Append( e.Row.GetCellText( band.Columns["ContactName"] ) );
		description.Append( "\n" );
		description.Append( e.Row.GetCellText( band.Columns["City"] ) );
		description.Append( ", " );
		description.Append( e.Row.GetCellText( band.Columns["Country"] ) );
	 
		// Set the row's Description to our custom description text.
		e.Row.Description = description.ToString( );
	}

}
'宣言
 
Public Event InitializeRow As InitializeRowEventHandler
 
参照