Show / Hide Table of Contents

Class ObservingCommandExtensions

Provides Prism-like syntactic extensions for ObservingCommand instances.

Inheritance
object
ObservingCommandExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.Mvvm.dll
Syntax
public static class ObservingCommandExtensions

Methods

| Edit this page View Source

CanExecuteIfNotDefault(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 command, enabling fluent syntax.

| Edit this page View Source

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 command, enabling fluent syntax.

Type Parameters
Name Description
T
| Edit this page View Source

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 command, enabling fluent syntax.

| Edit this page View Source

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 command, enabling fluent syntax.

Type Parameters
Name Description
T
| Edit this page View Source

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

command, allowing Fluent syntax.

Exceptions
Type Condition
InvalidArgumentException

Thrown if the member selected by selector is not a property or a method with a bool return type.

| Edit this page View Source

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

command, allowing Fluent syntax.

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 selector is not a property or a method with a bool return type.

| Edit this page View Source

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

command, allowing Fluent syntax.

Exceptions
Type Condition
InvalidArgumentException

Thrown if any member selected by properties is not a property.

| Edit this page View Source

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

command, allowing Fluent syntax.

Type Parameters
Name Description
T
Exceptions
Type Condition
InvalidArgumentException

Thrown if any member selected by properties is not a property.

| Edit this page View Source

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

command, allowing Fluent syntax.

Type Parameters
Name Description
TProperty
Exceptions
Type Condition
InvalidArgumentException

Thrown if any member selected by properties is not a property.

| Edit this page View Source

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

command, allowing Fluent syntax.

Type Parameters
Name Description
T
TProperty
Exceptions
Type Condition
InvalidArgumentException

Thrown if any member selected by properties is not a property.

| Edit this page View Source

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

command, allowing Fluent syntax.

Exceptions
Type Condition
InvalidArgumentException

Thrown if the member selected by propertySelector is not a property.

| Edit this page View Source

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

command, allowing Fluent syntax.

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 propertySelector is not a property.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX