I have nested groupboxes, which logically represent nested data structures in my application. Let's say i have a structure like this:
Dev1
- CDev1
- CDev2
- ICDev1
- ICDev2
I have checkboxes to enable/disable each of these Devs. I want to bind the CheckState of the child checkboxes to the parent checkbox's CheckState. I want the mechanism to work like this: When i check CDev2, ICDev1 & ICDev2 get automatically checked. But when I uncheck ICDev1, CDev2 stays in its own state. Basically, i want these events to be propagated to children but not to parent, like one way binding.
I am using .Net 2.0 SP2. I don't know if this is possible or not, therefore i would be glad if you show me some pointers about this. If it's not possible, i am going to implement event handlers for all checkboxes.
Try this:
childCheckBox.DataBindings.Add("Checked", parentCheckBox, "Checked");
You might also want to take a look at the TreeView control, it has the option to display CheckBox next to each item.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With