Class ObservableValidationBase<TViewModel, TValue>
- Namespace
- ReactiveUI.Validation.Components
- Assembly
- ReactiveUI.Validation.dll
A validation component that is based on an IObservable<T>.
public abstract class ObservableValidationBase<TViewModel, TValue> : ReactiveObject, IDisposable, IPropertyValidationComponent, IValidationComponent, IValidatesProperties
Type Parameters
TViewModel
TValue
- Inheritance
-
ObservableValidationBase<TViewModel, TValue>
- Implements
- Derived
- Extension Methods
Constructors
ObservableValidationBase(IObservable<IValidationState>)
Initializes a new instance of the ObservableValidationBase<TViewModel, TValue> class.
protected ObservableValidationBase(IObservable<IValidationState> observable)
Parameters
observable
IObservable<IValidationState>Observable that updates the view model property validity.
ObservableValidationBase(TViewModel, IObservable<TValue>, Func<TViewModel, TValue, bool>, Func<TViewModel, TValue, bool, IValidationText>)
Initializes a new instance of the ObservableValidationBase<TViewModel, TValue> class.
protected ObservableValidationBase(TViewModel viewModel, IObservable<TValue> observable, Func<TViewModel, TValue, bool> isValidFunc, Func<TViewModel, TValue, bool, IValidationText> messageFunc)
Parameters
viewModel
TViewModelViewModel instance.
observable
IObservable<TValue>Observable that updates the view model property validity.
isValidFunc
Func<TViewModel, TValue, bool>Func to define if the viewModelProperty is valid or not.
messageFunc
Func<TViewModel, TValue, bool, IValidationText>Func to define the validation error message.
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 observable for validation state changes.
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)