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
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.
<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