Class ValidationContext
- Namespace
- ReactiveUI.Validation.Contexts
- Assembly
- ReactiveUI.Validation.dll
Core interface which all validation components must implement.
public class ValidationContext : ReactiveObject, IDisposable, IValidationComponent
- Inheritance
-
ValidationContext
- Implements
- Extension Methods
Remarks
Contains all of the IValidationComponent instances applicable to the view model.
Constructors
ValidationContext(IScheduler?)
Initializes a new instance of the ValidationContext class.
public ValidationContext(IScheduler? scheduler = null)
Parameters
scheduler
ISchedulerOptional scheduler to use for the properties. Uses the current thread scheduler by default.
Properties
IsValid
Gets a value indicating whether the validation is currently valid or not.
public bool IsValid { get; }
Property Value
Text
Gets the current (optional) validation message.
public IValidationText Text { get; }
Property Value
Valid
Gets an observable for the Valid state.
public IObservable<bool> Valid { get; }
Property Value
ValidationStatusChange
Gets the observable for validation state changes.
public IObservable<IValidationState> ValidationStatusChange { get; }
Property Value
Validations
Gets get the list of validations.
public ReadOnlyObservableCollection<IValidationComponent> Validations { get; }
Property Value
Methods
Add(IValidationComponent)
Adds a validation into the validations collection.
public void Add(IValidationComponent validation)
Parameters
validation
IValidationComponentValidation component to be added into the collection.
Dispose()
public void Dispose()
Dispose(bool)
Disposes of the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
GetIsValid()
Returns if the whole context is valid checking all the validations.
public bool GetIsValid()
Returns
- bool
Returns true if the ValidationContext is valid, otherwise false.
Remove(IValidationComponent)
Removes a validation from the validations collection.
public void Remove(IValidationComponent validation)
Parameters
validation
IValidationComponentValidation component to be removed from the collection.
RemoveMany(IEnumerable<IValidationComponent>)
Removes many validation components from the validations collection.
public void RemoveMany(IEnumerable<IValidationComponent> validations)
Parameters
validations
IEnumerable<IValidationComponent>Validation components to be removed from the collection.