Validation against values of other properties

Topics: Validation Application Block
Jun 12, 2007 at 10:40 AM

consider I have a Adress class with properties like City, Street, Number.....

Now i want City to be VALID:
- if it IS NOT empty
- if it IS empty but Street, Number etc have to be empty too

Can I achieve this using existing validators or i have to create my own?

Jun 12, 2007 at 3:22 PM
You can use SelfValidation for scenarios like this.

It was talked recently here.




David Hayden
Microsoft MVP C#
Jun 13, 2007 at 7:12 AM
Yes i read about SelfValidation, but i dont want to add new validation results, i just want existing property to be valid or not depending on the value of another property. I am integrating those results with WPF validation. Assume you have 20 properties and they are dependent on each other in many ways.