/// <summary> /// Removes the property error from the properties list /// of validation errors. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="errorCode">The error code.</param> public void RemovePropertyError(string propertyName, int errorCode) { bool raiseEvent = false; lock (errorsLock) { if (errorsField == null) { return; } ObservableCollection <DataValidationError> list = errorsField[propertyName]; DataValidationError dataValidationError = list.SingleOrDefault(e => e.Id == errorCode); if (dataValidationError != null) { list.Remove(dataValidationError); raiseEvent = true; } } if (raiseEvent) { OnErrorsChanged(propertyName); } }
/// <summary> /// Adds a property error for the specified propertyName. /// This may produce a prompt in the UI to correct /// the error before proceeding. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="dataValidationError">The data validation error.</param> public void AddPropertyError( string propertyName, DataValidationError dataValidationError) { SetPropertyErrors(propertyName, new List <DataValidationError> { dataValidationError }); }