Back to Devexpress

TreeList.FindNode(Predicate<TreeListNode>) Method

windowsforms-devexpress-dot-xtratreelist-dot-treelist-dot-findnode-x28-system-dot-predicate-devexpress-dot-xtratreelist-dot-nodes-dot-treelistnode-x29.md

latest2.8 KB
Original Source

TreeList.FindNode(Predicate<TreeListNode>) Method

Returns the first node that matches the specified criteria.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
public TreeListNode FindNode(
    Predicate<TreeListNode> match
)
vb
Public Function FindNode(
    match As Predicate(Of TreeListNode)
) As TreeListNode

Parameters

NameTypeDescription
matchPredicate<TreeListNode>

The method that defines a set of criteria and determines whether a TreeListNode meets those criteria.

|

Returns

TypeDescription
TreeListNode

The first node that matches the specified criteria. null ( Nothing in Visual Basic) if no matching node is found.

|

Remarks

The FindNode method calls the specified predicate for each node in the data source until the predicate returns true. When this happens, the currently processed node is returned by the FindNode method.

The following example shows how you can get the first node that has the “London” string in the City column:

csharp
TreeListNode myNode = treeList1.FindNode((node) => {
    return node["City"].ToString() == "London";
}
);
vb
Dim myNode As TreeListNode = TreeList1.FindNode(Function(node)
    Return node("City").ToString() = "London"
End Function)

See Also

FindNodeByFieldValue(String, Object)

FindNodeByID(Int32)

FindNodeByKeyID(Object)

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace