Class ValidationSource<T>
Executes data validations within an IValidatingViewModel.
Implements
Inherited Members
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public sealed class ValidationSource<T> : ValidationSource, INotifyDataErrorInfo where T : IValidatingViewModel
Type Parameters
| Name | Description |
|---|---|
| T | The ViewModel type whose data will be validated by this instance. |
Constructors
| Edit this page View SourceValidationSource(T)
Executes data validations within an IValidatingViewModel.
Declaration
public ValidationSource(T npcSource)
Parameters
| Type | Name | Description |
|---|---|---|
| T | npcSource | Instance that is the source of validation data. |
Methods
| Edit this page View SourceGetErrors(Expression<Func<T, object?>>)
Enumerates validation errors for the specified property.
Declaration
public IEnumerable<string> GetErrors(Expression<Func<T, object?>> propertySelector)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, object>> | propertySelector | Property for which to obtain validation errors. |
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | An enumeration with all validation errors for the selected property. |
RegisterValidation<TValue>(Expression<Func<T, TValue>>)
Registers a set of rules in the validation instance.
Declaration
public IValidationEntry<TValue> RegisterValidation<TValue>(Expression<Func<T, TValue>> propertySelector)
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, TValue>> | propertySelector | Expression that selects the property to configure. |
Returns
| Type | Description |
|---|---|
| IValidationEntry<TValue> | The same validation-instance to allow Fluent syntax. |
Type Parameters
| Name | Description |
|---|---|
| TValue | Type of the property. |