This example handles the TreeList.BeforeCheckNode event to do the following:
- Set the same check state for all child nodes if the parent node's check state changes.
- Check the parent node if at least one child node is checked.
private void treeList1_BeforeCheckNode(object sender, CheckNodeEventArgs e) {
TreeListNode node = e.Node;
if(node.Checked)
node.UncheckAll();
else node.CheckAll();
while(node.ParentNode != null) {
node = node.ParentNode;
node.CheckState = AnyChildIsChecked(node) ? CheckState.Checked : CheckState.Unchecked;
}
}
- Main.cs (VB: Main.vb)
- TreeListCheckHelper.cs (VB: TreeListCheckHelper.vb)
(you will be redirected to DevExpress.com to submit your response)