Skip to content

DevExpress-Examples/winforms-treelist-show-checkboxes-for-specific-level

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)