Class ObservingCommandBuilder<T>
Wrapper class that allows for the configuration and generation of an ObservingCommand.
Inherited Members
Namespace: TheXDS.MCART.Helpers
Assembly: MCART.Mvvm.dll
Syntax
public class ObservingCommandBuilder<T> where T : INotifyPropertyChanged
Type Parameters
Name | Description |
---|---|
T | Type of the observed object. |
Properties
| Edit this page View SourceIsBuilt
Gets a value indicating whether the ObservingCommand has been fully defined through this instance.
Declaration
public bool IsBuilt { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceBuild()
Finalizes the configuration of the underlying ObservingCommand and returns it.
Declaration
public ObservingCommand Build()
Returns
Type | Description |
---|---|
ObservingCommand | The ObservingCommand that has been configured through this instance. |
CanExecute(Func<bool>)
Explicitly sets the check function that determines whether the ObservingCommand being configured can be executed.
Declaration
public ObservingCommandBuilder<T> CanExecute(Func<bool> canExecute)
Parameters
Type | Name | Description |
---|---|---|
Func<bool> | canExecute | A function that determines if the command can be executed. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecute(Func<object?, bool>)
Explicitly sets the check function that determines whether the ObservingCommand being configured can be executed.
Declaration
public ObservingCommandBuilder<T> CanExecute(Func<object?, bool> canExecute)
Parameters
Type | Name | Description |
---|---|---|
Func<object, bool> | canExecute | A function that determines if the command can be executed. The function will accept a parameter provided by the data binding. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfFilled(params Expression<Func<T, string?>>[])
Configures the ObservingCommand to be executable when the specified properties contain values different from the default value for their respective types.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfFilled(params Expression<Func<T, string?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, string>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfNotDefault(params Expression<Func<T, object?>>[])
Configures the ObservingCommand to be executable when the specified properties are not equal to null or their default value if they are value types.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfNotDefault(params Expression<Func<T, object?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, object>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfNotEmpty(params Expression<Func<T, IEnumerable<object?>?>>[])
Configures the ObservingCommand to be executable when the specified collections contain at least one element.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfNotEmpty(params Expression<Func<T, IEnumerable<object?>?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, IEnumerable<object>>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfNotNull(params Expression<Func<T, object?>>[])
Configures the ObservingCommand to be executable when the specified properties are not equal to null.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfNotNull(params Expression<Func<T, object?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, object>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfNotZero<TValue>(params Expression<Func<T, TValue>>[])
Configures the ObservingCommand to be executable when the specified properties have values different from their default ordinal value.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfNotZero<TValue>(params Expression<Func<T, TValue>>[] properties) where TValue : notnull, IComparable<TValue>
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
Type Parameters
Name | Description |
---|---|
TValue | Type of the values. |
CanExecuteIfObservedIsFilled()
Configures the ObservingCommand to be executable when all readable and writable properties of the observed object have values different from their respective default values.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfObservedIsFilled()
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfValid(params Expression<Func<T, double>>[])
Configures the ObservingCommand to be executable when the specified properties have valid floating-point values, meaning they are not NegativeInfinity, PositiveInfinity or NaN.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfValid(params Expression<Func<T, double>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, double>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfValid(params Expression<Func<T, double?>>[])
Configures the ObservingCommand to be executable when the specified properties have valid floating-point values, meaning they are not NegativeInfinity, PositiveInfinity, NaN or null.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfValid(params Expression<Func<T, double?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, double?>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfValid(params Expression<Func<T, float?>>[])
Configures the ObservingCommand to be executable when the specified properties have valid floating-point values, meaning they are not NegativeInfinity, PositiveInfinity, NaN or null.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfValid(params Expression<Func<T, float?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, float?>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
CanExecuteIfValid(params Expression<Func<T, float>>[])
Configures the ObservingCommand to be executable when the specified properties have valid floating-point values, meaning they are not NegativeInfinity, PositiveInfinity or NaN.
Declaration
public ObservingCommandBuilder<T> CanExecuteIfValid(params Expression<Func<T, float>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, float>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
ListensTo(params Expression<Func<T, object?>>[])
Indicates that the ObservingCommand being configured will listen for changes to the specified properties.
Declaration
public ObservingCommandBuilder<T> ListensTo(params Expression<Func<T, object?>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, object>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
ListensToCanExecute(Expression<Func<T, bool>>)
Indicates that the ObservingCommand being configured will listen to a property of type bool and use it as the determinant of whether the command can be executed.
Declaration
public ObservingCommandBuilder<T> ListensToCanExecute(Expression<Func<T, bool>> selector)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, bool>> | selector | Selector function for the property to be used. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
ListensTo<TValue>(params Expression<Func<T, TValue>>[])
Indicates that the ObservingCommand being configured will listen for changes to the specified properties.
Declaration
public ObservingCommandBuilder<T> ListensTo<TValue>(params Expression<Func<T, TValue>>[] properties)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>>[] | properties | A collection of selector expressions that specify the properties to listen to. |
Returns
Type | Description |
---|---|
ObservingCommandBuilder<T> | This instance of the ObservingCommandBuilder<T>, allowing for Fluent syntax. |
Type Parameters
Name | Description |
---|---|
TValue |
Operators
| Edit this page View Sourceimplicit operator ObservingCommand(ObservingCommandBuilder<T>)
Implicitly converts this instance to a ObservingCommand.
Declaration
public static implicit operator ObservingCommand(ObservingCommandBuilder<T> command)
Parameters
Type | Name | Description |
---|---|---|
ObservingCommandBuilder<T> | command | The object to convert. |
Returns
Type | Description |
---|---|
ObservingCommand |