Version

Parent Property (UltraTreeNode)

Gets the parent UltraTreeNode of the node.
Syntax
'Declaration
 
Public ReadOnly Property Parent As UltraTreeNode
public UltraTreeNode Parent {get;}
Remarks

For a root node, the return value is Nothing

Example
The following sample code illustrates how UIElements can be used. It finds out what element the user clicked on and outputs some context information about the element.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTree

Private Sub ultraTree1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraTree1.Click

    Dim mainElement As UIElement
    Dim element As UIElement
    Dim screenPoint As Point
    Dim clientPoint As Point
    Dim node As UltraTreeNode

    ' Get the control's main element
    mainElement = Me.ultraTree1.UIElement

    ' Convert the current mouse position to a point
    ' in client coordinates of the control.
    screenPoint = Control.MousePosition
    clientPoint = Me.ultraTree1.PointToClient(screenPoint)

    ' Get the element at that point
    element = mainElement.ElementFromPoint(clientPoint)

    If element Is Nothing Then Return

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

    ' Get the group that this element is contained in.
    node = element.GetContext(GetType(UltraTreeNode))

    If Not node Is Nothing Then
        Debug.WriteLine("in node: " + node.Key + " - " + node.Text)
    End If

    ' Walk up the parent element chain and write out a line 
    ' for each parent element.
    While Not element.Parent Is Nothing
        element = element.Parent
        Debug.WriteLine("is a child of an " + element.GetType().ToString())
        Debug.Indent()
    End While

    'reset the indent level
    Debug.IndentLevel = 0

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

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

	UIElement mainElement;
	UIElement element;
	Point screenPoint;
	Point clientPoint;
	UltraTreeNode node;

	// Get the control's main element
	mainElement = this.ultraTree1.UIElement;
 
	// Convert the current mouse position to a point
	// in client coordinates of the control.
	screenPoint = Control.MousePosition;
	clientPoint = this.ultraTree1.PointToClient( screenPoint );

	// Get the element at that point
	element = mainElement.ElementFromPoint( clientPoint );

	if ( element == null )
		return;

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

	// Get the node that contains this element.
	node = element.GetContext( typeof( UltraTreeNode ) )
					as UltraTreeNode;
	
	if ( node != null )
		Debug.WriteLine( "in node: " + node.Key +" - " + node.Text );

	// Walk up the parent element chain and write out a line 
	// for each parent element.
	while (element.Parent != null )
	{
		element = element.Parent;
		Debug.WriteLine("is a child of an " + element.GetType().ToString());
		Debug.Indent();
	}

	// reset the indent level
	Debug.IndentLevel = 0;
		
}
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