DxTreeView.SetNodeChecked(Func<ITreeViewNodeInfo, Boolean>, Boolean) Method
Checks or unchecks the specified node.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public void SetNodeChecked(
Func<ITreeViewNodeInfo, bool> predicate,
bool check
)
Parameters
Name | Type | Description |
---|---|---|
predicate | Func<ITreeViewNodeInfo, Boolean> | A method delegate that specifies a particular node. |
check | Boolean |
|
Remarks
Use the SetNodeChecked
method to check or uncheck the specified node in code.
The following code snippet recursively checks nodes on expand:
<DxTreeView @ref="MyTreeView"
Data="@Data"
CheckMode="TreeViewCheckMode.Recursive"
AfterExpand="NodeExpanded">
<DataMappings>
<DxTreeViewDataMapping Text="Name"
Key="Id"
ParentKey="CategoryId" />
</DataMappings>
</DxTreeView>
@code {
DxTreeView MyTreeView;
void NodeExpanded(TreeViewNodeEventArgs e) {
if (e.NodeInfo.Checked != true)
MyTreeView.SetNodeChecked((n) => n.Text == e.NodeInfo.Text, true);
}
}
See Also