Skip to main content
A newer version of this page is available. .

TreeList.BeforeCheckNode Event

Occurs before a node’s check state is changed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v18.2.dll

Declaration

public event CheckNodeEventHandler BeforeCheckNode

Event Data

The BeforeCheckNode event's data class is DevExpress.XtraTreeList.CheckNodeEventArgs.

Remarks

The BeforeCheckNode event is raised when an end-user changes a node’s check state, and allows you to cancel the operation or specify the required check state.

To cancel the operation, set the event parameter’s CanCheck property to false. The previous and current node states are returned by the PrevState and State properties, respectively. You can change the State property’s value to specify the required node state.

The following code prevents an end-user from setting nodes to an indeterminate state.


private void treeList1_BeforeCheckNode(object sender, DevExpress.XtraTreeList.CheckNodeEventArgs e) {
    if (e.State == CheckState.Indeterminate)
        e.State = (e.PrevState == CheckState.Checked ? CheckState.Unchecked : CheckState.Checked);
}

After a node’s state has been changed, the TreeList.AfterCheckNode event is raised.

See Node Checking - Checkboxes and Radio Buttons to learn more.

The following code snippets (auto-collected from DevExpress Examples) contain references to the BeforeCheckNode event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also