I've got a sequence of checkboxes on a C# Winform. Each checkbox can have some options on it, which is really just another set of checkboxes that are just indented into the page a bit.
What I'm trying to achieve is when you tick one of the parent checkboxes then all it's child checkboxes get ticked. And the opposite when a parent checkbox is unticked where all it's child checkboxes get unticked.
Then I need to have it so that if a child checkbox get's ticked then it ticks it's parent, or at least ensures that the parent is ticked. Ie you can't have a child without the parent. And if a child is unticked then if all the other children are unticked then the parent needs to be unticked.
I'm doing this with event handlers on the checkboxes but I've come against the problem where checking a child with the cursor then programmatically checks the parent which then programmatically checks all it's children.
I would very much appriciate any advice on how to program this in such a way that it doesn't have a problem like this.