views:

19

answers:

0

I have a series of checkboxes on a form. One or more must be checked, and if not I want to display an error icon on them until one of them is.

My IDataErrorInfo implementation looks like so:

public string this[string columnName]
{
    get
    {
        switch (columnName)
        {
            case "option1":
            case "option2":
            case "option3":
                if (!this.option1 && !this.option2 && !this.option3)
                    return "Please select one or more of the 3 options";
        }
    }
}

Now, if none of the checkboxes that are bound to options1-3 are checked, each checkbox will have an error icon on them, which is fine, but when one of them IS checked, only that one checkbox will have its error icon removed (as opposed to all of them).

What's the ideal way of having the form re-poll validation for options1-3 when any one of them is changed?

If it helps (though I don't think it should be much different from normal winforms controls), I'm using DevExpress UI controls, so the checkboxes are CheckBoxEdit's and the ErrorProvider is the DxErrorProvider.

EDIT: SOLVED

I ended up manually notifying of property changed for the other options when one was changed.

private bool option1;
public bool Option1
{
    get { return this.option1; }
    set
    {
        this.option1 = value;

        this.notifyPropertyChanged("Option1");
        this.notifyPropertyChanged("Option2");
        this.notifyPropertyChanged("Option3");
    }
}

// repeat for options2-3