Class ObservingCommandExtensions
Provides Prism-like syntactic extensions for ObservingCommand instances.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.Mvvm.dll
Syntax
public static class ObservingCommandExtensions
Methods
| Edit this page View SourceCanExecuteIfNotDefault(ObservingCommand, params Expression<Func<ValueType>>[])
Configures an ObservingCommand to be executable when the specified value-type properties are not equal to their default value.
Declaration
public static ObservingCommand CanExecuteIfNotDefault(this ObservingCommand command, params Expression<Func<ValueType>>[] propertySelectors)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | Command to configure. |
| Expression<Func<ValueType>>[] | propertySelectors | Property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand | The |
CanExecuteIfNotDefault<T>(ObservingCommand, params Expression<Func<T, ValueType>>[])
Configures an ObservingCommand to be executable when the specified value-type properties on the observed source are not equal to their default values.
Declaration
public static ObservingCommand CanExecuteIfNotDefault<T>(this ObservingCommand command, params Expression<Func<T, ValueType>>[] propertySelectors)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | Command to configure. |
| Expression<Func<T, ValueType>>[] | propertySelectors | Property selectors (targeting the observed source) to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand | The |
Type Parameters
| Name | Description |
|---|---|
| T |
CanExecuteIfNotNull(ObservingCommand, params Expression<Func<object?>>[])
Configures an ObservingCommand to be executable when the specified properties are not null.
Declaration
public static ObservingCommand CanExecuteIfNotNull(this ObservingCommand command, params Expression<Func<object?>>[] propertySelectors)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | Command to configure. |
| Expression<Func<object>>[] | propertySelectors | Property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand | The |
CanExecuteIfNotNull<T>(ObservingCommand, params Expression<Func<T, object?>>[])
Configures an ObservingCommand to be executable when the specified properties on the observed source are not null.
Declaration
public static ObservingCommand CanExecuteIfNotNull<T>(this ObservingCommand command, params Expression<Func<T, object?>>[] propertySelectors)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | Command to configure. |
| Expression<Func<T, object>>[] | propertySelectors | Property selectors (targeting the observed source) to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand | The |
Type Parameters
| Name | Description |
|---|---|
| T |
ListensToCanExecute(ObservingCommand, Expression<Func<bool>>)
Specifies that an ObservingCommand will listen for change notifications of the selected property or method used for the CanExecute(object) flag.
Declaration
public static ObservingCommand ListensToCanExecute(this ObservingCommand command, Expression<Func<bool>> selector)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listener will be configured. |
| Expression<Func<bool>> | selector | Lambda expression selecting a property or a method that returns bool. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if the member selected by |
ListensToCanExecute<T>(ObservingCommand, Expression<Func<T, bool>>)
Specifies that an ObservingCommand will listen for change notifications of the selected property or method used for the CanExecute(object) flag.
Declaration
public static ObservingCommand ListensToCanExecute<T>(this ObservingCommand command, Expression<Func<T, bool>> selector)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listener will be configured. |
| Expression<Func<T, bool>> | selector | Lambda expression selecting a property or a method that returns bool. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Type Parameters
| Name | Description |
|---|---|
| T | Type of object for which to select a property or method (commonly the reference this). |
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if the member selected by |
ListensToProperties(ObservingCommand, params Expression<Func<object?>>[])
Registers a set of properties to be listened to by this ObservingCommand.
Declaration
public static ObservingCommand ListensToProperties(this ObservingCommand command, params Expression<Func<object?>>[] properties)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listeners will be configured. |
| Expression<Func<object>>[] | properties | Collection of property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if any member selected by |
ListensToProperties<T>(ObservingCommand, params Expression<Func<T, object?>>[])
Registers a set of properties to be listened to by this ObservingCommand.
Declaration
public static ObservingCommand ListensToProperties<T>(this ObservingCommand command, params Expression<Func<T, object?>>[] properties)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listeners will be configured. |
| Expression<Func<T, object>>[] | properties | Collection of property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if any member selected by |
ListensToProperties<TProperty>(ObservingCommand, params Expression<Func<TProperty>>[])
Registers a set of properties to be listened to by this ObservingCommand.
Declaration
public static ObservingCommand ListensToProperties<TProperty>(this ObservingCommand command, params Expression<Func<TProperty>>[] properties)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listeners will be configured. |
| Expression<Func<TProperty>>[] | properties | Collection of property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Type Parameters
| Name | Description |
|---|---|
| TProperty |
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if any member selected by |
ListensToProperties<T, TProperty>(ObservingCommand, params Expression<Func<T, TProperty>>[])
Registers a set of properties to be listened to by this ObservingCommand.
Declaration
public static ObservingCommand ListensToProperties<T, TProperty>(this ObservingCommand command, params Expression<Func<T, TProperty>>[] properties)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listeners will be configured. |
| Expression<Func<T, TProperty>>[] | properties | Collection of property selectors to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Type Parameters
| Name | Description |
|---|---|
| T | |
| TProperty |
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if any member selected by |
ListensToProperty(ObservingCommand, Expression<Func<object?>>)
Specifies that an ObservingCommand will listen for change notifications of the selected property.
Declaration
public static ObservingCommand ListensToProperty(this ObservingCommand command, Expression<Func<object?>> propertySelector)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listener will be configured. |
| Expression<Func<object>> | propertySelector | Lambda expression selecting the property to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if the member selected by |
ListensToProperty<T>(ObservingCommand, Expression<Func<T, object?>>)
Specifies that an ObservingCommand will listen for change notifications of the selected property.
Declaration
public static ObservingCommand ListensToProperty<T>(this ObservingCommand command, Expression<Func<T, object?>> propertySelector)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservingCommand | command | The command for which the listener will be configured. |
| Expression<Func<T, object>> | propertySelector | Lambda expression selecting the property to observe. |
Returns
| Type | Description |
|---|---|
| ObservingCommand |
|
Type Parameters
| Name | Description |
|---|---|
| T | Type of object for which to select a property (commonly the reference this). |
Exceptions
| Type | Condition |
|---|---|
| InvalidArgumentException | Thrown if the member selected by |