Table of Contents

Class DataValidationBase

Namespace
Avalonia.Data.Core.Plugins
Assembly
Avalonia.Base.dll

Base class for data validators.

public abstract class DataValidationBase : PropertyAccessorBase, IPropertyAccessor, IDisposable, IObserver<object?>
Inheritance
DataValidationBase
Implements
Inherited Members

Remarks

Data validators are IPropertyAccessors that are returned from an IDataValidationPlugin. They wrap an inner IPropertyAccessor and convert any values received from the inner property accessor into BindingNotifications.

Constructors

DataValidationBase(IPropertyAccessor)

Initializes a new instance of the DataValidationBase class.

protected DataValidationBase(IPropertyAccessor inner)

Parameters

inner IPropertyAccessor

The inner property accessor.

Properties

PropertyType

Gets the type of the property.

public override Type? PropertyType { get; }

Property Value

Type

Exceptions

InvalidOperationException

The accessor has not been subscribed to yet.

Value

Gets the current value of the property.

public override object? Value { get; }

Property Value

object

Methods

InnerValueChanged(object?)

Called when the inner IPropertyAccessor notifies with a new value.

protected virtual void InnerValueChanged(object? value)

Parameters

value object

The value.

Remarks

Notifies the observer that the value has changed. The value will be wrapped in a BindingNotification if it is not already a binding notification.

SetValue(object?, BindingPriority)

Sets the property value.

public override bool SetValue(object? value, BindingPriority priority)

Parameters

value object

The value to set. Guaranteed to be of a valid type for the property.

priority BindingPriority

The priority with which to set the value.

Returns

bool

True if the property was set; false if the property could not be set.

SubscribeCore()

Begins listening to the inner IPropertyAccessor.

protected override void SubscribeCore()

UnsubscribeCore()

When overridden in a derived class, stops listening to the member.

protected override void UnsubscribeCore()