Version

ResetExpansionIndicator(Int32) Method

Sets the HasExpansionIndicator property to true for all nodes at a paricular level in the tree. Applies only to nodes whose Override.ShowExpansionIndicator property is set to CheckOnExpand.
Syntax
'Declaration
 
Public Overloads Sub ResetExpansionIndicator( _
   ByVal level As Integer _
) 
public void ResetExpansionIndicator( 
   int level
)

Parameters

level
An Integer specifying the Level of nodes to reset.
Remarks

This method essentially resets the expansion indicator of a node that is loading chilren "on demand.".

When a node whose Override.ShowExpansionIndicator property is set to CheckOnExpand is expanded and no children are added, the expansion indicator on the node disappears. Calling this method will bring the expansion indicator back so that the node may be expanded again. This can be necessary if, for example, the back-end data has changed.

Example
The following sample code illustrates some of the information available in the BeforeExpand event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win.UltraWinTree

Private Sub ultraTree1_BeforeExpand(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.CancelableNodeEventArgs) Handles ultraTree1.BeforeExpand

    ' Note: In order to load node collections on demand, set
    ' the appropriate Override object's 'ShowExpansionIndicator' 
    ' property to 'CheckOnExpand'. Then in this event place 
    ' logic to add the child nodes to the node being expanded 
    ' (e.g. with the e.TreeNode.Nodes's 'Add' or 'AddRange' methods).
    '
    ' In addition to its 'Tag' property the node exposes
    ' a 'DataKey' property (which is also opaque to the node).
    ' It is often useful with 'CheckOnDemand' to associate
    ' some identifier/key of a corresponding row in a dataset.
    '
    ' With 'CheckOnExpand' specified, if this event is called 
    ' and no child nodes are added then the expansion indicator
    ' will disappear and this event will not fire again. 
    '
    ' However, this can be reset by calling the UltraTree's 
    ' 'ResetExpansionIndicator' method to re-show the expansion
    ' indicator and re-fire this event when the user expands the
    ' node again.
    '
    ' Refer to the 'UltraTree Load On Demand VB' sample.

    Dim sb As New System.Text.StringBuilder()

    sb.Append("Node: ")
    sb.Append(e.TreeNode.Key)
    sb.Append(" is about to be expanded.")

    Debug.WriteLine(sb.ToString())

    ' Note : This action can be canceled by the following line of code.
    'e.Cancel = True

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

private void ultraTree1_BeforeExpand(object sender, Infragistics.Win.UltraWinTree.CancelableNodeEventArgs e)
{

	// Note: In order to load node collections on demand, set
	// the appropriate Override object's 'ShowExpansionIndicator' 
	// property to 'CheckOnExpand'. Then in this event place 
	// logic to add the child nodes to the node being expanded 
	// (e.g. with the e.TreeNode.Nodes's 'Add' or 'AddRange' methods).
	//
	// In addition to its 'Tag' property the node exposes
	// a 'DataKey' property (which is also opaque to the node).
	// It is often useful with 'CheckOnDemand' to associate
	// some identifier/key of a corresponding row in a dataset.
	//
	// With 'CheckOnExpand' specified, if this event is called 
	// and no child nodes are added then the expansion indicator
	// will disappear and this event will not fire again. 
	//
	// However, this can be reset by calling the UltraTree's 
	// 'ResetExpansionIndicator' method to re-show the expansion
	// indicator and re-fire this event when the user expands the
	// node again.
	//
	// Refer to the 'UltraTree Load On Demand CS' sample.
	
	System.Text.StringBuilder sb = new System.Text.StringBuilder();

	sb.Append("Node: ");
	sb.Append(e.TreeNode.Key);
	sb.Append(" is about to be expanded.");

	Debug.WriteLine( sb.ToString() );

	// Note : This action can be canceled by the following line of code.
	//e.Cancel = true;
		
}
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