0

Is there a way using WPF ValidationRules to validate the updated field with the data in another datagrid on the same form?

My page looks like this:

Ranges
Min Max
 1  10

Rank
 5

So in this situation the Rank is updated and I need to make sure it is between the min and max in the rangea on another datagrid. I am using this pattern to validate data from the grid but it doesn't work when I need to pass it data on from another grid:

public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
        EF.Rank rank = (value as BindingGroup).Items[0] as EF.Rank;

        //Need to Access the Ranges list from another datagrid on the same page to validate the the rank that was entered is between the min and max which can be adjusted.
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Stevenr12
  • 108
  • 7
  • 1
    From Microsoft official WPF course materials: `ValidationRules` are only to be used as simple validations (For instance Required fields, numeric formats, etc). If you need advanced / complex Business Rules validation, you should either implement `IDataErrorInfo` or create your own validation mechanism (that's what I did and it works like a charm) – Federico Berasategui Jul 29 '13 at 23:08

1 Answers1

0

From Microsoft official WPF course materials: ValidationRules are only to be used as simple validations (For instance Required fields, numeric formats, etc). If you need advanced / complex Business Rules validation, you should either implement IDataErrorInfo or create your own validation mechanism (that's what I did and it works like a charm)

  • Seems like it would be a common scenario, I'm a bit surprise Microsoft's validation rules only support simple validations. Do you have any insight into how you did it with your own custom validation framework? I would still like to use the if I can. – Stevenr12 Jul 30 '13 at 15:35