Search Results for

    Show / Hide Table of Contents

    Class ViewModelCommon

    Base class recommended to use for view models across the application. Encapsulates implementations of INotifyPropertyChanged and INotifyDataErrorInfo.

    Inheritance
    Object
    ViewModelCommon
    ViewModel
    Implements
    IViewModelCommon
    INotifyDataErrorInfo
    IProgressReporterCommon
    INotifyPropertyChanged
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: BionicCode.Utilities.Net
    Assembly: BionicCode.Utilities.Net.Common.dll
    Syntax
    public abstract class ViewModelCommon : IViewModelCommon, INotifyDataErrorInfo, IProgressReporterCommon, INotifyPropertyChanged

    Constructors

    | Improve this Doc View Source

    ViewModelCommon()

    Default constructor

    Declaration
    protected ViewModelCommon()

    Fields

    | Improve this Doc View Source

    DisableIndterminateMode

    Constant representing value of NegativeInfinity. When assigned to Progress and when calling the default implementation of OnProgress(ProgressData) the value will automatically set IsIndeterminate to false.

    Declaration
    public const double DisableIndterminateMode = -Infinity
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    EnableIndterminateMode

    Constant representing value of PositiveInfinity. When assigned to Progress and when calling the default implementation of OnProgress(ProgressData) the value will automatically set IsIndeterminate to true.

    Declaration
    public const double EnableIndterminateMode = Infinity
    Field Value
    Type Description
    Double

    Properties

    | Improve this Doc View Source

    HasErrors

    Declaration
    public bool HasErrors { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsIndeterminate

    Indicates that the progress reporting is indeterminate.

    Declaration
    public bool IsIndeterminate { get; set; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    IsReportingProgress

    Indicates ongoing progress reporting

    Declaration
    public bool IsReportingProgress { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    Raises PropertyChanged event.

    | Improve this Doc View Source

    ProgressText

    The progress message.

    Declaration
    public string ProgressText { get; set; }
    Property Value
    Type Description
    String
    Remarks

    Raises PropertyChanged event.

    | Improve this Doc View Source

    ProgressValue

    The progress value.

    Declaration
    public double ProgressValue { get; set; }
    Property Value
    Type Description
    Double
    Remarks

    Raises PropertyChanged event.

    Methods

    | Improve this Doc View Source

    ClearErrors(String)

    Removes all error objects related to a property.

    Declaration
    protected virtual bool ClearErrors(string propertyName)
    Parameters
    Type Name Description
    String propertyName

    The property to clear error objects for.

    Returns
    Type Description
    Boolean

    true if an item was removed or false if no item was removed or the property was not found.

    | Improve this Doc View Source

    CreateProgressReporterFromCurrentThread()

    Creates a IProgress<T> instance that is associated with the caller's thread. The registered progress callback is the virtual ViewModelCommon.OnProgress(ProgressData) member.

    Declaration
    public IProgress<ProgressData> CreateProgressReporterFromCurrentThread()
    Returns
    Type Description
    IProgress<ProgressData>

    A IProgress<T> instance that posts progress to the thread CreateProgressReporterFromCurrentThread() was called from.

    Remarks

    To create a IProgress<T> instance that is associated with the application's primary dispatcher thread of a Windows targeting application, for example to update proerties that bind to a DispatcherObject, call CreateProgressReporterFromUiThread.

    | Improve this Doc View Source

    GetErrors(String)

    Gets all error messages of the specified property. If the propertyName is null all error messages will be returned.

    Declaration
    public IEnumerable GetErrors(string propertyName = null)
    Parameters
    Type Name Description
    String propertyName

    The of the property of which the error messages should be returned.

    Returns
    Type Description
    IEnumerable

    An IEnumerable containing all error messages of the specified property.

    Remarks

    If the propertyName is null all current error messages will be returned.

    | Improve this Doc View Source

    GetPropertyErrors(String)

    Gets all error messages of the specified property. If the propertyName is null all error messages will be returned.

    Declaration
    public IEnumerable<string> GetPropertyErrors(string propertyName = null)
    Parameters
    Type Name Description
    String propertyName

    The of the property of which the error messages should be returned.

    Returns
    Type Description
    IEnumerable<String>

    Returns an IEnumerable<T> containing all error messages of the specified property.

    Remarks

    If the propertyName is null all current error messages will be returned.

    | Improve this Doc View Source

    IsPropertyAttributeValid<TValue>(TValue, String)

    Validates the value of a particular property against decorating validation attributes.

    Declaration
    protected virtual bool IsPropertyAttributeValid<TValue>(TValue value, string propertyName)
    Parameters
    Type Name Description
    TValue value

    The value to validate.

    String propertyName

    The name of the property to validate.

    Returns
    Type Description
    Boolean

    true if vcalidation passed or the property is not decorated with any validation attributes. Otherwise false.

    Type Parameters
    Name Description
    TValue
    | Improve this Doc View Source

    IsValueValid<TValue>(TValue, PropertyValidationDelegate<TValue>, String)

    Can be used to check whether a value is valid.

    Declaration
    protected virtual bool IsValueValid<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The value to check.

    PropertyValidationDelegate<TValue> validationDelegate

    The validation delegate Func<T, TResult>which is invoked on the value.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    true when the value is valid, otherwise false.

    Type Parameters
    Name Description
    TValue

    Generic type parameter of the value to check.

    Remarks

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    IsValueValidAsync<TValue>(TValue, PropertyValidationDelegateAsync<TValue>, String)

    Can be used to check whether a value is valid.

    Declaration
    protected virtual async Task<bool> IsValueValidAsync<TValue>(TValue value, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The value to check.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The validation delegate Func<T, TResult>which is invoked on the value.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    true when the value is valid, otherwise false.

    Type Parameters
    Name Description
    TValue

    Generic type parameter of the value to check.

    Remarks

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    OnErrorsChanged(String)

    Raised when the validation state of the view model has changed (e.g. error added or removed).

    Declaration
    protected virtual void OnErrorsChanged(string propertyName)
    Parameters
    Type Name Description
    String propertyName
    | Improve this Doc View Source

    OnProgress(ProgressData)

    When overridden, handles the Report(T) that is invoked by the IProgress<T> instance returned from CreateProgressReporterFromCurrentThread(). Can be used as progress delegate for any IProgress<T>.

    Declaration
    protected virtual void OnProgress(ProgressData progress)
    Parameters
    Type Name Description
    ProgressData progress

    The progress argument.

    Remarks

    The default implementation provides the followwing logic: a value of NegativeInfinity or DisableIndterminateMode will automatically set the IsIndeterminate property to false. A value of PositiveInfinity or EnableIndterminateMode will automatically set the IsIndeterminate property to true.

    | Improve this Doc View Source

    OnProgressChanged(Double, Double)

    Raises the ProgressChanged event.

    Declaration
    protected virtual void OnProgressChanged(double oldValue, double newValue)
    Parameters
    Type Name Description
    Double oldValue

    The old progress value.

    Double newValue

    The new progress value.

    | Improve this Doc View Source

    OnProgressChanged(Double, Double, String)

    Raises the ProgressChanged event.

    Declaration
    protected virtual void OnProgressChanged(double oldValue, double newValue, string progressText)
    Parameters
    Type Name Description
    Double oldValue

    The old progress value.

    Double newValue

    The new progress value.

    String progressText

    The progress message.

    | Improve this Doc View Source

    OnPropertyChanged(Object, Object, String)

    Method called to fire a PropertyChanged event. Also raises the PropertyChanged event to support binding.

    Declaration
    [NotifyPropertyChangedInvocator]
    protected virtual void OnPropertyChanged(object oldValue, object newValue, string propertyName = null)
    Parameters
    Type Name Description
    Object oldValue

    The value before the property change.

    Object newValue

    The value after the property change.

    String propertyName

    The property name.

    | Improve this Doc View Source

    OnPropertyChanged(String)

    Method called to fire a PropertyChanged event. Also raises the PropertyChanged event to support binding.

    Declaration
    [NotifyPropertyChangedInvocator]
    protected virtual void OnPropertyChanged(string propertyName = null)
    Parameters
    Type Name Description
    String propertyName

    The property name.

    | Improve this Doc View Source

    PropertyHasError(String)

    Checks whether the specified property has errors or is valid.

    Declaration
    public virtual bool PropertyHasError(string propertyName = null)
    Parameters
    Type Name Description
    String propertyName

    The name of the property to check for errors.

    Returns
    Type Description
    Boolean

    true when the specified property has at least one error. Otherwise false when the property is valid.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, ref TValue, ViewModelCommon.SetValueOptions, String)

    Generic property setter. Sets the value of any property of the extending view model by passing in a the corresponding property backing field. Automatically raises the PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    ViewModelCommon.SetValueOptions methodConfiguration

    Use to configure the method's behavior.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when equality checking is enabled and the new property equals the old property value.

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and must be explicitly disabled if needed by passing a ViewModelCommon.SetValueOptions to the apropriate overload. To determine equality ReferenceEquals(Object, Object) is called.
    This means when the new property value value equals the old value, then the PropertyChanged event won't be raised.
    To change the equality definition use an overload that accepts an IEqualityComparer<T> (for example TrySetValue<TValue>(TValue, ref TValue, IEqualityComparer<TValue>, String)).

    To validate the value, use the TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.
    For asynchronous validation use the TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, ref TValue, IEqualityComparer<TValue>, ViewModelCommon.SetValueOptions, String)

    Generic property setter. Sets the value of any property of the extending view model by passing in a the corresponding property backing field. Automatically raises the PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, ref TValue targetBackingField, IEqualityComparer<TValue> equalityComparer, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality.
    Passing in an IEqualityComparer automatically enables value rejection in case the equality test succeeds (new value and old value are equal). If equalityComparer is >NULL ReferenceEquals(Object, Object) will be used to test for equality.

    ViewModelCommon.SetValueOptions methodConfiguration

    Use to configure the method's behavior.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when equality checking is enabled and the new property equals the old property value.

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and must be explicitly disabled if needed by passing a ViewModelCommon.SetValueOptions to the apropriate overload. To determine equality ReferenceEquals(Object, Object) is called.
    This means when the new property value value equals the old value, then the PropertyChanged event won't be raised. If equality checking is enabled and no IEqualityComparer<T> was provided by setting the equalityComparer parameter or the value is NULL, the method will check for reference equality using ReferenceEquals(Object, Object).

    To validate the value, use the TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.
    For asynchronous validation use the TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, ref TValue, IEqualityComparer<TValue>, String)

    Generic property setter. Sets the value of any property of the extending view model by passing in a the corresponding property backing field. Automatically raises the PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, ref TValue targetBackingField, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality.
    Passing in an IEqualityComparer automatically enables value rejection in case the equality test succeeds (new value and old value are equal). If equalityComparer is >NULL ReferenceEquals(Object, Object) will be used to test for equality.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when equality checking is enabled and the new property equals the old property value.

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and must be explicitly disabled if needed by passing a ViewModelCommon.SetValueOptions to the apropriate overload. To determine equality ReferenceEquals(Object, Object) is called.
    This means when the new property value value equals the old value, then the PropertyChanged event won't be raised. If equality checking is enabled and no IEqualityComparer<T> was provided by setting the equalityComparer parameter or the value is NULL, the method will check for reference equality using ReferenceEquals(Object, Object).

    To validate the value, use the TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.
    For asynchronous validation use the TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, ref TValue, String)

    Generic property setter. Sets the value of any property of the extending view model by passing in a the corresponding property backing field. Automatically raises the PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when equality checking is enabled and the new property equals the old property value.

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and must be explicitly disabled if needed by passing a ViewModelCommon.SetValueOptions to the apropriate overload. To determine equality ReferenceEquals(Object, Object) is called.
    This means when the new property value value equals the old value, then the PropertyChanged event won't be raised.
    To change the equality definition use an overload that accepts an IEqualityComparer<T> (for example TrySetValue<TValue>(TValue, ref TValue, IEqualityComparer<TValue>, String)).

    To validate the value, use the TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.
    For asynchronous validation use the TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String) method.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur and the feature is always enabled by default) and the new value equals the old value, then the PropertyChanged event won't be raised.
    If equality checking is enabled and no valid IEqualityComparer<T> was provided by setting the equalityComparer parameter, the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, ViewModelCommon.SetValueOptions, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur and the feature is always enabled by default) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur and the feature is always enabled by default) and the new value equals the old value, then the PropertyChanged event won't be raised.
    If equality checking is enabled and no valid IEqualityComparer<T> was provided by setting the equalityComparer parameter, the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur and the feature is always enabled by default) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValue<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, String)

    Sets the value of the referenced property and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValue<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    If the value is NULL the validation delegate validationDelegate is executed and the related method result is returned but a validation error is not recorded.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is NULL, the value is validated without generating an error. This is because validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.

    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, String)

    Support for asynchronous validation. Sets the value of the referenced property and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate

    A SetBackingFieldDelegate<TValue>. This delegate is required to set the backingfield of a property by an async method. Async methods can't define ref parameters.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Generic property setter. Silently sets the value of any property of the extending view model by passing in a the corresponding property backing field. Suppresses a PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when the property value didn't change (e.g. on equality of old and new value).

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, ref TValue, ViewModelCommon.SetValueOptions, String)

    Generic property setter. Silently sets the value of any property of the extending view model by passing in a the corresponding property backing field. Suppresses a PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method. .

    Returns
    Type Description
    Boolean

    true when the property has changed or false when the property value didn't change (e.g. on equality of old and new value).

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, ref TValue, IEqualityComparer<TValue>, String)

    Generic property setter. Silently sets the value of any property of the extending view model by passing in a the corresponding property backing field. Suppresses a PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, ref TValue targetBackingField, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when the property value didn't change (e.g. on equality of old and new value).

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, ref TValue, String)

    Generic property setter. Silently sets the value of any property of the extending view model by passing in a the corresponding property backing field. Suppresses a PropertyChanged event for this property.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new property value.

    TValue targetBackingField

    The backing field of the target property for the new value. Passed in by reference using ref keyword.

    String propertyName

    The name of the property that changes. By default the property name is automatically set to the property that called this setter method.

    Returns
    Type Description
    Boolean

    true when the property has changed or false when the property value didn't change (e.g. on equality of old and new value).

    Type Parameters
    Name Description
    TValue

    The generic type parameter of the new property value.

    Remarks

    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, ViewModelCommon.SetValueOptions, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, PropertyValidationDelegate<TValue>, ref TValue, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, PropertyValidationDelegate<TValue> validationDelegate, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    PropertyValidationDelegate<TValue> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, ViewModelCommon.SetValueOptions, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    ViewModelCommon.SetValueOptions methodConfiguration

    A ViewModelCommon.SetValueOptions object to configure the behavior of the method.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, IEqualityComparer<TValue> equalityComparer, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilent<TValue>(TValue, Func<TValue, (Boolean IsValid, IEnumerable<Object> ErrorMessages)>, ref TValue, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes a validation delegate.

    Declaration
    protected virtual bool TrySetValueSilent<TValue>(TValue value, Func<TValue, (bool IsValid, IEnumerable<object> ErrorMessages)> validationDelegate, ref TValue targetBackingField, string propertyName = null)
    Parameters
    Type Name Description
    TValue value

    The new value which is to be set to the property.

    Func<TValue, System.ValueTuple<Boolean, IEnumerable<Object>>> validationDelegate

    The callback that is used to validate the new value.

    TValue targetBackingField

    The reference to the backing field.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Boolean

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the validationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the value is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if validationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    ViewModelCommon.SetValueOptions methodConfiguration
    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    ViewModelCommon.SetValueOptions methodConfiguration
    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, PropertyValidationDelegateAsync<TValue>, SetBackingFieldDelegate<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, PropertyValidationDelegateAsync<TValue> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    PropertyValidationDelegateAsync<TValue> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    ViewModelCommon.SetValueOptions methodConfiguration
    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, ViewModelCommon.SetValueOptions, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, ViewModelCommon.SetValueOptions methodConfiguration, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    ViewModelCommon.SetValueOptions methodConfiguration
    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    it is recommended to set methodConfiguration property IsThrowExceptionOnValidationErrorEnabled to true.
    If not doing so, the binding target will clear the new value and show the last valid value instead.
    If equality checking is enabled by setting the methodConfiguration parameter's property IsRejectEqualValuesEnabled to true (the parameter defaults to trur) and the new value equals the old value, then the PropertyChanged event won't be raised.
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    ArgumentException

    Thrown if methodConfiguration is configured with IsThrowExceptionOnValidationErrorEnabled set to true and validation failed

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, IEqualityComparer<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, IEqualityComparer<TValue> equalityComparer, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    IEqualityComparer<TValue> equalityComparer

    A IEqualityComparer<T> to check for value equality. If this optional parameter is not provided ReferenceEquals(Object, Object) will be used.

    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    | Improve this Doc View Source

    TrySetValueSilentAsync<TValue>(TValue, TValue, Func<TValue, Task<(Boolean IsValid, IEnumerable<Object> ErrorMessages)>>, SetBackingFieldDelegate<TValue>, String)

    Silently sets the value of the referenced property without raising PropertyChanged and executes an asynchronous validation delegate.

    Declaration
    protected virtual async Task<bool> TrySetValueSilentAsync<TValue>(TValue newValue, TValue oldValue, Func<TValue, Task<(bool IsValid, IEnumerable<object> ErrorMessages)>> asyncValidationDelegate, SetBackingFieldDelegate<TValue> backingFieldSetterDelegate, string propertyName = "")
    Parameters
    Type Name Description
    TValue newValue

    The new value which is to be set to the property.

    TValue oldValue

    The current value.

    Func<TValue, Task<System.ValueTuple<Boolean, IEnumerable<Object>>>> asyncValidationDelegate

    The asynchronous callback that is used to validate the new value.

    SetBackingFieldDelegate<TValue> backingFieldSetterDelegate
    String propertyName

    The name of the property to set. Default name is the property that called this method.
    Use null to validate the value without generating an error.

    Returns
    Type Description
    Task<Boolean>

    Returns true if the new value doesn't equal the old value and the new value is valid. Returns false if the new value equals the old value or the validation has failed.

    Type Parameters
    Name Description
    TValue

    The generic value type parameter

    Remarks

    This property setter supports invalid value rejection, which means values are only assigned to the backing field if they are valid which is when the asyncValidationDelegate return true.
    To support visual validation error feed back and proper behavior in TwoWay binding scenarios where the validation mode Binding.ValidatesOnExceptions of the System.Windows.Binding is set to true,
    Equality checking is enabled by default and the method will check for reference equality using ReferenceEquals(Object, Object).

    When the propertyName value is null, the newValue is validated without generating an error. Validation errors are always related to a particular property.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if asyncValidationDelegate is NULL.

    Events

    | Improve this Doc View Source

    ErrorsChanged

    Declaration
    public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged
    Event Type
    Type Description
    EventHandler<DataErrorsChangedEventArgs>
    | Improve this Doc View Source

    ProgressChanged

    Raised when ProgressValue, ProgressText or IsIndeterminate has changed.

    Declaration
    public event ProgressChangedEventHandler ProgressChanged
    Event Type
    Type Description
    ProgressChangedEventHandler
    | Improve this Doc View Source

    PropertyChanged

    Event fired whenever a child property changes its value.

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    PropertyChangedEventHandler
    | Improve this Doc View Source

    PropertyValueChanged

    PropertyChanged implementation that sends old value and new value of the change and raises the INotifyPropertyChanged event.

    Declaration
    public event PropertyValueChangedEventHandler<object> PropertyValueChanged
    Event Type
    Type Description
    PropertyValueChangedEventHandler<Object>

    Implements

    IViewModelCommon
    INotifyDataErrorInfo
    IProgressReporterCommon
    INotifyPropertyChanged

    Extension Methods

    HelperExtensionsCommon.ToDictionary(Object)
    HelperExtensionsCommon.ToFlatDictionary(Object)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX