10
I'm starting to implement validation in my WPF project via the IDataErrorInfo interface. My business object contains multiple properties with validation info. How do I get a list of ALL the error messages associated with the object. My thought is that thats what the Error property is for, but I cannot track down anyone using this for reporting on multiple properties.
Thanks!
public string this[string property]
{
get {
string msg = null;
switch (property)
{
case "LastName":
if (string.IsNullOrEmpty(LastName))
msg = "Need a last name";
break;
case "FirstName":
if (string.IsNullOrEmpty(LastName))
msg = "Need a first name";
break;
default:
throw new ArgumentException(
"Unrecognized property: " + property);
}
return msg;
}
}
public string Error
{
get
{
return null ;
}
}