It seems that due to the fact that IDataErrorInfo processes only one error at a time, you will have to do this in a VM construct:
public string this[string columnName] { get { string error = String.Empty; switch (columnName) { case "RelationOther": if (!string.IsNullOrEmpty(RelationOther) && !RelationTypeMap[10]) error = "Ошибка! Указание описания не требуется"; break; case "ChildsNum": if ((SexMap[0] || FullOld < 15) && (ChildsNum ?? 0) > 0) error = "Ошибка! Количество детей указывают только женщины от 15 лет и старше"; break; case "ChildBirthDate": if ((SexMap[0] || FullOld < 15) && ChildBirthDate != null) error = "Ошибка! Дату рождения первого ребенка указывают только женщины от 15 лет и старше"; break; } return error; } } public string Error => string.Empty; public bool IsValid => Errors.Any(e => string.IsNullOrEmpty(e)); public List<string> Errors => new List<string>() { this["RelationOther"], this["ChildsNum"], this["ChildBirthDate"] }; #endregion
Then the isValid property will indicate that there are validation errors in the window at the moment.
Does anyone know a better solution?