I have a data entry form, with its DataCountext bound to a ViewModel object.
The form contains (among other things) a number of CheckBox elements, each bound to a boolean in the ViewModel. These CheckBoxes are grouped into two GroupBoxes.
There are two business requirements I don’t know how to handle.
- At least one checkbox in groupbox 1 is selected, or at least one checkbox in groupbox 2 is selected.
- If anything in groupbox 1 is selected, everything in groupbox 2 is unselected, and vice versa.
Anyone have any ideas?
Solution for problem 1 is simple – have the Property setter in the VM clear the fields that should not be set. Binding will update the display appropriately.
Solution for problem 2 is a bit more complicated. If I want to display an error at the GroupBox level, I need to attach a BindingGroup to the GroupBox, and add an appropriate ValidationRule to it.