Show / Hide Table of Contents

Class FormViewModelBase

Clase base que permite definir un ViewModel que provee de servicios de formulario y validación de datos.

Inheritance
object
NotifyPropertyChangeBase
NotifyPropertyChanged
ViewModelBase
FormViewModelBase
Implements
INotifyPropertyChangeBase
IRefreshable
INotifyPropertyChanged
INotifyDataErrorInfo
Inherited Members
ViewModelBase.IsBusy
ViewModelBase.Observe<T>(Expression<Func<T>>, Action)
ViewModelBase.Observe(Expression<Func<object>>[], Action)
ViewModelBase.Observe(string, Action)
ViewModelBase.Observe(string[], Action)
ViewModelBase.ObserveFrom<T>(T, Expression<Func<T, object>>, Action)
ViewModelBase.ObserveFrom(INotifyPropertyChanged, PropertyInfo, Action)
ViewModelBase.BusyOp(Action)
ViewModelBase.BusyOp(Task)
ViewModelBase.BusyOp<T>(Func<T>)
ViewModelBase.BusyOp<T>(Task<T>)
NotifyPropertyChanged.PropertyChanged
NotifyPropertyChanged.Notify(params string[])
NotifyPropertyChanged.Notify(string)
NotifyPropertyChanged.RaisePropertyChangeEvent(in string, in PropertyChangeNotificationType)
NotifyPropertyChangeBase.OnInitialize(NotifyPropertyChangeBase.IPropertyBroadcastSetup)
NotifyPropertyChangeBase.Refresh()
NotifyPropertyChangeBase.Subscribe(PropertyInfo, PropertyChangeObserver)
NotifyPropertyChangeBase.Subscribe(PropertyChangeObserver)
NotifyPropertyChangeBase.Subscribe(Expression<Func<object>>, PropertyChangeObserver)
NotifyPropertyChangeBase.Unsubscribe(PropertyChangeObserver)
NotifyPropertyChangeBase.Unsubscribe(PropertyInfo)
NotifyPropertyChangeBase.Unsubscribe(Expression<Func<object>>)
NotifyPropertyChangeBase.Change<T>(ref T, T, string)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public abstract class FormViewModelBase : ViewModelBase, INotifyPropertyChangeBase, IRefreshable, INotifyPropertyChanged, INotifyDataErrorInfo

Properties

| Edit this page View Source

ErrorSource

Returns this instance, required for proper INotifyPropertyChanged implementation.

Declaration
public INotifyDataErrorInfo ErrorSource { get; }
Property Value
Type Description
INotifyDataErrorInfo
| Edit this page View Source

HasErrors

Gets a value indicating whether this instance has any validation errors.

Declaration
public bool HasErrors { get; }
Property Value
Type Description
bool

Methods

| Edit this page View Source

CheckErrors()

Checks for validation errors.

Declaration
public bool CheckErrors()
Returns
Type Description
bool

true if all validations passed, false otherwise.

| Edit this page View Source

GetErrors(string?)

Enumerates the errors for the provided property name, or for all properties if propertyName is null.

Declaration
public IEnumerable GetErrors(string? propertyName)
Parameters
Type Name Description
string propertyName

Name of the property for which to get the errors. If it is an empty string or null, this method will return all validation errors.

Returns
Type Description
IEnumerable

An enumeration of all validation errors for the specified property or for all properties.

| Edit this page View Source

OnDoChange<T>(ref T, T, string)

Reemplaza el método Change<T>(ref T, T, string), permitiendo la ejecución de validaciones sobre una propiedad.

Declaration
protected override void OnDoChange<T>(ref T backingStore, T value, string propertyName)
Parameters
Type Name Description
T backingStore

Field that holds the property value.

T value

Value to be set.

string propertyName

Name of the property. This parameter should be omitted always, unless you need to specify a different property to be notified.

Type Parameters
Name Description
T

Type of backing field.

Overrides
NotifyPropertyChanged.OnDoChange<T>(ref T, T, string)
| Edit this page View Source

RegisterValidation<T>(Expression<Func<T>>)

Registers a property validation ruleset.

Declaration
protected FormViewModelBase.IValidationEntry<T> RegisterValidation<T>(Expression<Func<T>> propertySelector)
Parameters
Type Name Description
Expression<Func<T>> propertySelector

Expression that selects the property to be configured.

Returns
Type Description
FormViewModelBase.IValidationEntry<T>

An object which allows the configuration of the validation rules to be applied to the selected property.

Type Parameters
Name Description
T

Property type.

| Edit this page View Source

ValidationAffects(params SimpleCommand[])

Tells to the validation engine that validation will affect the specified commands.

Declaration
protected void ValidationAffects(params SimpleCommand[] commands)
Parameters
Type Name Description
SimpleCommand[] commands

Collection of commands to be affected by validation failures.

Remarks

Please call this method after instancing the commands.

Events

| Edit this page View Source

ErrorsChanged

Triggered whenever validations are run.

Declaration
public event EventHandler<DataErrorsChangedEventArgs>? ErrorsChanged
Event Type
Type Description
EventHandler<DataErrorsChangedEventArgs>

Implements

INotifyPropertyChangeBase
IRefreshable
INotifyPropertyChanged
INotifyDataErrorInfo

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
ObservingCommandBuilder.Create<T>(T, Action)
ObservingCommandBuilder.Create<T>(T, Action<object?>)
ObservingCommandBuilder.Create<T>(T, Func<object?, Task>)
ObservingCommandBuilder.Create<T>(T, Func<Task>)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
NotifyPropertyChangeBaseExtensions.Subscribe<T>(T, Expression<Func<T, object?>>, PropertyChangeObserver)
NotifyPropertyChangeBaseExtensions.Unsubscribe<T>(T, Expression<Func<T, object?>>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX