Version

Expanded Property

Gets/Sets whether or not the node is Expanded.
Syntax
'Declaration
 
Public Property Expanded As Boolean
public bool Expanded {get; set;}
Remarks

The Expanded property of a node is independent of whether or not the node has any children. If a node with no children has its Expanded property set to true, the node will act as though it is expanded. This means it will use the ExpandedNodeAppearance and if child nodes are added to it, they will display immediately without having to re-expand the parent.

Example
The following code illustrates how to toggle the expanded state of nodes.

Imports Infragistics.Win.UltraWinTree

Private Sub button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button11.Click

    Dim node As UltraTreeNode

    node = Me.ultraTree1.ActiveNode

    If node Is Nothing Then Return

    ' toggle the expansion state of this node and all its
    ' descendant nodes.
    If node.Expanded = True Then
        node.CollapseAll()
    Else
        node.ExpandAll(ExpandAllType.OnlyNodesWithChildren)
    End If

    ' Note: The following code toggles the expansion state
    ' of this node only (not all of its descendant nodes):
    'node.Expanded = Not node.Expanded

    ' Note: To expand or collapse all of the nodes in the
    ' tree use the control's 'ExpandAll' or 'CollapseAll'.
    ' The following code illustrates:
    'Me.ultraTree1.ExpandAll(ExpandAllType.OnlyNodesWithChildren)
    'Me.ultraTree1.CollapseAll()

End Sub
using Infragistics.Win.UltraWinTree;

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

	UltraTreeNode node = this.ultraTree1.ActiveNode;
		
	if ( node == null )
		return;

	// toggle the expansion state of this node and all its
	// descendant nodes.
	if ( node.Expanded == true )
		node.CollapseAll();
	else
		node.ExpandAll( ExpandAllType.OnlyNodesWithChildren );

	// Note: The following code toggles the expansion state
	// of this node only (not all of its descendant nodes):
	//node.Expanded = !node.Expanded;


	// Note: To expand or collapse all of the nodes in the
	// tree use the control's 'ExpandAll' or 'CollapseAll'.
	// The following code illustrates:
	//this.ultraTree1.ExpandAll( ExpandAllType.OnlyNodesWithChildren );
	//this.ultraTree1.CollapseAll();

}
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