Add a method to ValidatingModelBase allowing someone to clear all errors

Relates to #17
This commit is contained in:
Antony Male 2016-11-25 17:12:43 +00:00
parent 9e9514a795
commit f2a61493e3
1 changed files with 24 additions and 0 deletions

View File

@ -184,6 +184,30 @@ namespace Stylet
}
}
/// <summary>
/// Clear all property errors
/// </summary>
protected virtual void ClearAllPropertyErrors()
{
List<string> changedProperties;
this.propertyErrorsLock.Wait();
try
{
changedProperties = this.propertyErrors.Keys.ToList();
this.propertyErrors.Clear();
}
finally
{
this.propertyErrorsLock.Release();
}
if (changedProperties.Count > 0)
{
this.OnValidationStateChanged(changedProperties);
}
}
/// <summary>
/// Validate a single property synchronously, by name
/// </summary>