Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 2.86 KB

File metadata and controls

49 lines (34 loc) · 2.86 KB

WinForms TreeList - Display node checkboxes for a specific tree level

This example shows how to show checkboxes within nodes displayed at a specified tree level and hide/disable checkboxes for other nodes.

The CustomDrawNodeCheckBox event is handled to hide checkboxes or set them to disabled.

void treeList_CustomDrawNodeCheckBox(object sender, CustomDrawNodeCheckBoxEventArgs e) {
    bool canCheckNode = CanCheckNode(e.Node);
    if (canCheckNode)
        return;
    e.ObjectArgs.State = DevExpress.Utils.Drawing.ObjectState.Disabled;
    e.Handled = NeedHide;
}

The BeforeCheckNode event is handled to prevent users from changing the state of disabled checkboxes.

void treeList_BeforeCheckNode(object sender, CheckNodeEventArgs e) {
    e.CanCheck = CanCheckNode(e.Node);
}

WinForms TreeList - Display node checkboxes for a specific tree level

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)