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

Finding Nodes

When searching for node(s) you have several options that you can use

  • The Find method which searches for a specific node by text
  • A predefined Predicate that returns the first node that matches the search criteria.
  • Use the FindNodes method which also provides overloads to search by Text or a Predicate and returns an array of nodes as a result.

The following example demonstrates how to search for a single node by its text and how to get all nodes whose Tag is not null by using a Predicate:

RadTreeNode resultOfSearch = radTreeView1.Find("Child Node");

Predicate<RadTreeNode> match = new Predicate<RadTreeNode>(delegate(RadTreeNode node)
{
    return node.Tag != null ? true : false;
});
RadTreeNode[] result = radTreeView1.FindNodes(match);

Dim resultOfSearch As RadTreeNode = RadTreeView1.Find("Child Node")
Dim match As New Predicate(Of RadTreeNode)(Function(node As RadTreeNode) If(node.Tag IsNot Nothing, True, False))
Dim result As RadTreeNode() = RadTreeView1.FindNodes(match)

See Also

In this article