バージョン

UIElement プロパティ (UltraGridLayout)

グリッドの中心となる UIElement を返します (読み取り専用)。
シンタックス
'宣言
 
Public ReadOnly Property UIElement As UltraGridUIElement
public UltraGridUIElement UIElement {get;}
使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub ultraGrid1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraGrid1.Click

       Dim mainElement As UIElement
       Dim element As UIElement
       Dim screenPoint As Point
       Dim clientPoint As Point
       Dim row As UltraGridRow
       Dim cell As UltraGridCell

       ' コントロールのメイン要素を取得します
       mainElement = Me.ultraGrid1.DisplayLayout.UIElement

       ' 現在のマウス位置をコントロールのクライアント座標
       ' のポイントに変換します
       screenPoint = Control.MousePosition
       clientPoint = Me.ultraGrid1.PointToClient(screenPoint)

       ' そのポイントにある要素を取得します
       element = mainElement.ElementFromPoint(clientPoint)

       If element Is Nothing Then Return

       Debug.WriteLine("Clicked on an " + element.GetType().ToString())
       Debug.Indent()

       ' この要素を含む行を取得します
       row = element.GetContext(GetType(UltraGridRow))

       If Not row Is Nothing Then

           Debug.WriteLine("in row: " + row.Index.ToString())

           ' この要素を含むセルを取得します
           cell = element.GetContext(GetType(UltraGridCell))

           If Not cell Is Nothing Then
               Debug.WriteLine("in column: " + cell.Column.Key)
               Debug.WriteLine("cell text: " + cell.Text)
           End If
       End If

       ' 親要素 チェーンをたどり、各親要素について 
       ' 1 行ずつ情報を出力します
       While Not element.Parent Is Nothing
           element = element.Parent
           Debug.WriteLine("is a child of an " + element.GetType().ToString())
           Debug.Indent()
       End While

       ' インデント レベルをリセットします
       Debug.IndentLevel = 0

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

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

	UIElement mainElement;
	UIElement element;
	Point screenPoint;
	Point clientPoint;
	UltraGridRow row;
	UltraGridCell cell;

	// コントロールのメイン要素を取得します
	mainElement = this.ultraGrid1.DisplayLayout.UIElement;
 
	// 現在のマウス位置をコントロールのクライアント座標
	// のポイントに変換します
	screenPoint = Control.MousePosition;
	clientPoint = this.ultraGrid1.PointToClient( screenPoint );

	// そのポイントにある要素を取得します
	element = mainElement.ElementFromPoint( clientPoint );

	if ( element == null )
		return;

	Debug.WriteLine( "Clicked on an " + element.GetType().ToString() );
	Debug.Indent();

	// この要素を含む行を取得します
	row = element.GetContext( typeof( UltraGridRow ) )
					as UltraGridRow;
	
	if ( row != null )
	{
		Debug.WriteLine( "in row: " + row.Index.ToString() );

		// この要素を含むセルを取得します
		cell = element.GetContext( typeof( UltraGridCell ) )
						as UltraGridCell;
		if ( cell != null )
		{
			Debug.WriteLine( "in column: " + cell.Column.Key );
			Debug.WriteLine( "cell text: " + cell.Text );
		}
	}

	// 親要素 チェーンをたどり、各親要素について 
	// 1 行ずつ情報を出力します
	while (element.Parent != null )
	{
		element = element.Parent;
		Debug.WriteLine("is a child of an " + element.GetType().ToString());
		Debug.Indent();
	}

	// インデント レベルをリセットします
	Debug.IndentLevel = 0;
		
}
参照