Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

Returns information about the specified nodes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
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 found nodes.

#Remarks

The following code snippet uses the GetNodesInfo method.

Razor
<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) => 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