Class BasePropertyValidation<TViewModel>
- Namespace
- ReactiveUI.Validation.Components
- Assembly
- ReactiveUI.Validation.dll
Base class for items which are used to build a ValidationContext.
public abstract class BasePropertyValidation<TViewModel> : ReactiveObject, IDisposable, IPropertyValidationComponent, IValidationComponent, IValidatesProperties
Type Parameters
TViewModel
- Inheritance
-
BasePropertyValidation<TViewModel>
- Implements
- Derived
- Extension Methods
Constructors
BasePropertyValidation()
Initializes a new instance of the BasePropertyValidation<TViewModel> class. Subscribe to the valid subject so we can assign the validity.
protected BasePropertyValidation()
Properties
IsValid
Gets a value indicating whether the validation is currently valid or not.
public bool IsValid { get; }
Property Value
Properties
Gets the properties associated with this validation component.
public IEnumerable<string> Properties { get; }
Property Value
PropertyCount
Gets the total number of properties referenced.
public int PropertyCount { get; }
Property Value
Text
Gets the current (optional) validation message.
public IValidationText? Text { get; }
Property Value
ValidationStatusChange
Gets the public mechanism indicating that the validation state has changed.
public IObservable<IValidationState> ValidationStatusChange { get; }
Property Value
Methods
AddProperty<TProp>(Expression<Func<TViewModel, TProp>>)
Adds a property to the list of this which this validation is associated with.
protected void AddProperty<TProp>(Expression<Func<TViewModel, TProp>> property)
Parameters
property
Expression<Func<TViewModel, TProp>>ViewModel property.
Type Parameters
TProp
Any type.
ContainsPropertyName(string, bool)
Determine if a property name is actually contained within this.
public bool ContainsPropertyName(string propertyName, bool exclusively = false)
Parameters
propertyName
stringViewModel property name.
exclusively
boolIndicates if the property to find is unique.
Returns
- bool
Returns true if it contains the property, otherwise false.
Dispose()
public void Dispose()
Dispose(bool)
Disposes of the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
GetValidationChangeObservable()
Get the validation change observable, implemented by concrete classes.
protected abstract IObservable<IValidationState> GetValidationChangeObservable()
Returns
- IObservable<IValidationState>
Returns the IValidationState collection.