Class
ValidateViewModelBase

Provides basic implementation of the IAsyncDataErrorInfo interface.

Definition

Namespace:Telerik.Core

Assembly:Telerik.WinUI.Controls.dll

Syntax:

cs-api-definition
public abstract class ValidateViewModelBase : ViewModelBase, INotifyPropertyChanged, IAsyncDataErrorInfo, INotifyDataErrorInfo

Inheritance: objectViewModelBaseValidateViewModelBase

Implements: IAsyncDataErrorInfoINotifyDataErrorInfoINotifyPropertyChanged

Inherited Members ViewModelBase.VerifyPropertyName(string)ViewModelBase.OnPropertyChanged(string)ViewModelBase.OnPropertyChanged<T>(Expression<Func<T>>)ViewModelBase.PropertyChangedOverride(string)ViewModelBase.PropertyChanged

Constructors

ValidateViewModelBase()

Declaration

cs-api-definition
protected ValidateViewModelBase()

Properties

HasErrors

Declaration

cs-api-definition
public bool HasErrors { get; }

Property Value

bool

Implements INotifyDataErrorInfo.HasErrors

Methods

AddError(string, object)

Adds error message to the specified property.

Declaration

cs-api-definition
protected virtual void AddError(string propertyName, object errorMessage)

Parameters

propertyName

string

Name of the property.

errorMessage

object

The error message.

GetErrors(string)

Declaration

cs-api-definition
public IEnumerable GetErrors(string propertyName)

Parameters

propertyName

string

Returns

IEnumerable

Implements INotifyDataErrorInfo.GetErrors(string)

OnErrorsChanged(string)

Raises the ErrorsChanged event.

Declaration

cs-api-definition
protected virtual void OnErrorsChanged(string propertyName)

Parameters

propertyName

string

Name of the property.

RemoveErrors(string)

Removes the errors for the specified property.

Declaration

cs-api-definition
protected virtual void RemoveErrors(string propertyName = null)

Parameters

propertyName

string

The name of the property to remove validation errors for; or null or Empty, to clear entity-level errors.

ValidateAsync(string)

Triggers validate logic asynchronously.

Declaration

cs-api-definition
public Task ValidateAsync(string propertyName)

Parameters

propertyName

string

The name of the property that needs validation.

Returns

Task

Implements IAsyncDataErrorInfo.ValidateAsync(string)

ValidateAsyncOverride(string)

Called by the method. Allows inheritors to provide custom validation logic.

Declaration

cs-api-definition
protected virtual Task ValidateAsyncOverride(string propertyName)

Parameters

propertyName

string

The name of the property that needs validation.

Returns

Task

Events

ErrorsChanged

Declaration

cs-api-definition
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged

Event Value

EventHandler<DataErrorsChangedEventArgs>

Implements INotifyDataErrorInfo.ErrorsChanged