New to Telerik UI for WinForms? Start a free 30-day trial

Traverses visible tree nodes in hierarchy order, descending into children only when their parent is expanded. Invisible nodes are included while the tree is in design mode.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class TreeViewTraverser : ITraverser<RadTreeNode>, IDisposable, IEnumerator, IEnumerable

Inheritance: objectTreeViewTraverser

Implements: IDisposableIEnumerableIEnumeratorITraverser<RadTreeNode>

Constructors

Creates a traverser for the specified tree view and positions it at the supplied node.

C#
public TreeViewTraverser(RadTreeViewElement owner, RadTreeNode position)
Parameters:ownerRadTreeViewElement

The tree element whose nodes are traversed.

positionRadTreeNode

The initial node position.

Creates a traverser for the specified tree view.

C#
public TreeViewTraverser(RadTreeViewElement owner)
Parameters:ownerRadTreeViewElement

The tree element whose nodes are traversed.

Properties

Gets the node at the current traversal position.

C#
public RadTreeNode Current { get; }
Property Value:

The current node, or null when traversal has no position.

Gets or sets the node at the current traversal position.

C#
public object Position { get; set; }
Property Value:

The current RadTreeNode, or null when no node is positioned.

Implements: ITraverser<RadTreeNode>.Position

Methods

Performs no cleanup; this traverser does not release resources or clear its node references.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Gets the cached enumerator positioned at this traverser's current node. Repeated calls reuse the same enumerator instance.

C#
public IEnumerator GetEnumerator()
Returns:

IEnumerator

The cached tree-node enumerator.

Implements: IEnumerable.GetEnumerator()

Searches backward from the current position, including the current node, for the specified node.

C#
public bool MoveBackward(RadTreeNode node)
Parameters:nodeRadTreeNode

The node to find.

Returns:

bool

true if the node is reached; otherwise, false.

Searches forward from the current position, including the current node, for the specified node.

C#
public bool MoveForward(RadTreeNode node)
Parameters:nodeRadTreeNode

The node to find.

Returns:

bool

true if the node is reached; otherwise, false.

Advances to the next visible node in hierarchy order, descending into children of expanded nodes. Nodes rejected by Traversing are skipped.

C#
public bool MoveNext()
Returns:

bool

true if another node was reached; otherwise, false.

Implements: IEnumerator.MoveNext()

Advances the internal position to the next visible node without raising Traversing.

C#
protected virtual bool MoveNextCore()
Returns:

bool

true if another node was reached; otherwise, false.

Moves to the preceding visible node, visiting the deepest visible descendant of an expanded previous sibling. When no node is positioned, starts at the first visible root node.

C#
public bool MovePrevious()
Returns:

bool

true if a node was reached; otherwise, false.

Implements: ITraverser<RadTreeNode>.MovePrevious()

Advances the internal position to the preceding visible node without raising Traversing.

C#
protected virtual bool MovePreviousCore()
Returns:

bool

true if a preceding node was reached; otherwise, false.

C#
public void MoveTo(int index)
Parameters:indexint

Resets traversal and returns the zero-based position of the specified node among nodes accepted by Traversing.

C#
public int MoveTo(RadTreeNode item)
Parameters:itemRadTreeNode

The node to locate.

Returns:

int

The node's position, or -1 if it is not reached.

Moves to the last root node accepted by Traversing, searching the root collection from end to beginning. This operation does not descend into child nodes.

C#
public bool MoveToEnd()
Returns:

bool

true if a root node was accepted; otherwise, false.

Implements: ITraverser<RadTreeNode>.MoveToEnd()

Raises the traversal event for the current node and returns whether traversal should yield it.

C#
protected bool OnTraversing()
Returns:

bool

true when the current node should be processed or no handler is registered.

Raises the Traversing event with the supplied event data.

C#
protected virtual void OnTraversing(TreeViewTraversingEventArgs e)
Parameters:eTreeViewTraversingEventArgs

The candidate node and its processing flag.

Resets traversal so the next move starts at the first root node.

C#
public void Reset()

Implements: IEnumerator.Reset()

Events

Occurs for each candidate node before traversal returns it. Set Process to false to skip that node.

C#
public event TreeViewTraversingEventHandler Traversing