Class ValidationSource
Executes data validations within an IValidatingViewModel.
Implements
Inherited Members
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public abstract class ValidationSource : INotifyDataErrorInfo
Properties
| Edit this page View SourceHasErrors
Gets a value that indicates whether the entity has validation errors.
Declaration
public bool HasErrors { get; }
Property Value
| Type | Description |
|---|---|
| bool | true if the entity currently has validation errors; otherwise, false. |
this[string]
Gets a collection of validation error messages for the specified property.
Declaration
public IEnumerable<string> this[string propertyName] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | Name of the property to retrieve error messages for. |
Property Value
| Type | Description |
|---|---|
| IEnumerable<string> | An enumeration of error messages for the specified property, or an empty enumeration if the property has no errors. |
PassesValidation
Indicates whether the object under validation has passed all validation checks.
Declaration
public bool PassesValidation { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceCheckErrors()
Executes validation checks for all configured validation entries.
Declaration
public bool CheckErrors()
Returns
| Type | Description |
|---|---|
| bool |
GetErrors()
Enumerates validation error messages for all configured properties of the observed ViewModel.
Declaration
public IEnumerable<string> GetErrors()
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | A collection with all validation error messages for the observed ViewModel. |
GetErrors(string?)
Enumerates validation errors for the specified property or for all properties.
Declaration
public IEnumerable GetErrors(string? propertyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | Property name to get validation errors for. If null or empty, errors for all properties are returned. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumeration with all validation errors for the property or the instance. |
Events
| Edit this page View SourceErrorsChanged
Occurs when the validation errors have changed for a property or for the entire entity.
Declaration
public event EventHandler<DataErrorsChangedEventArgs>? ErrorsChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<DataErrorsChangedEventArgs> |