void ValidateProperty(string propertyName) { var results = new ValidationResultCollection(); AttributeBasedValidation(propertyName, results); OnValidateProperty(propertyName, results); OnErrorsChanged(propertyName, ErrorsDictionary.SetErrors(propertyName, results)); }
void ValidateObject() { var results = new ValidationResultCollection(); OnValidateObject(results); OnErrorsChanged("", ErrorsDictionary.SetErrors(results, out var affectedProperties)); foreach (var p in affectedProperties) { OnErrorsChanged(p); } }
void Initialize() { m_PropertyChangedEventManager = new PropertyChangedEventManager(this); m_Errors = new ErrorsDictionary(); }
/// <summary> /// Returns a collection of property-level errors. /// </summary> /// <param name="propertyName">Null or String.Empty will return the object-level errors</param> /// <returns></returns> /// <remarks> /// Call Validate() to refresh this property. /// </remarks> public ReadOnlyCollection <ValidationResult> GetErrors(string propertyName) { return(ErrorsDictionary.GetErrors(propertyName)); }
/// <summary> /// Returns a collection of all errors (object and property level). /// </summary> /// <returns></returns> /// <remarks> /// Call Validate() to refresh this property. /// </remarks> public ReadOnlyCollection <ValidationResult> GetAllErrors() { return(ErrorsDictionary.GetAllErrors()); }
/// <summary> /// Clears the error collections and the HasErrors property /// </summary> public void ClearErrors() { OnErrorsChanged("", ErrorsDictionary.Clear()); }