DxTreeView.GetNodesInfo(Func<ITreeViewNodeInfo, Boolean>) Method

Returns information about the specified nodes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public IEnumerable<ITreeViewNodeInfo> GetNodesInfo(
    Func<ITreeViewNodeInfo, bool> predicate
)

Parameters

Name Type Description
predicate Func<ITreeViewNodeInfo, Boolean>

A method delegate that specifies nodes.

Returns

Type Description
IEnumerable<ITreeViewNodeInfo>

Information about the specified nodes.

Remarks

The code sample below demonstrates how to use the GetNodesInfo method.

<DxTreeView @ref="@treeView" 
    AllowSelectNodes="true" 
    SelectionChanged="@SelectionChanged" ...> 
    ... 
</DxTreeView> 

@code { 
    DxTreeView treeView; 
    protected void SelectionChanged(TreeViewNodeEventArgs e) { 
        if (e.NodeInfo.Parent != null) { 
            var parentSiblingNodesInfo = treeView.GetNodesInfo(n.Level == e.NodeInfo.Parent.Level && !string.Equals(n.Name, e.NodeInfo.Parent.Name)); 
            foreach (var nodeInfo in parentSiblingNodesInfo) 
                treeView.SetNodeExpanded(n => string.Equals(n.Name, nodeInfo.Name), false); 
        } 
        else 
            treeView.CollapseAll(); 
    } 
} 
NOTE

This method is not in effect if Load Child Nodes on Demand mode is enabled, and the specified node is not loaded yet.

See Also