Skip to main content
All docs
V23.2

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

Checks or unchecks the specified node.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.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

true to check a node; false to uncheck a node.

Remarks

Use the SetNodeChecked method to check or uncheck the specified node in code.

The code below 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