,System.Windows.Input.ICommand)} ,--1,System.Linq.Expressions.Expression},System.String,System.String,System.Int32)}
ReactiveUIBindingExtensions.InvokeCommand(IObservable, ICommand) method¶
Defined in
Type: ReactiveUIBindingExtensions
Namespace: ReactiveUI.Binding.Reactive
Assembly: ReactiveUI.Binding.Reactive.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-tvos18.0, net9.0-maccatalyst18.0, net9.0-ios18.0, net9.0-macos15.0, net9.0-desktop1.0, net8.0, net8.0-macos14.5, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, netstandard2.1, net481, net462, net471
Overloads¶
- 1.
public static IDisposable InvokeCommand<T>(this IObservable<T> source, ICommand command) - 2.
public static IDisposable InvokeCommand<T, TTarget>(this IObservable<T> source, TTarget? target, Expression<Func<TTarget, ICommand?>> commandProperty, string commandPropertyExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TTarget : class
1. Overload¶
public static IDisposable InvokeCommand<T>(this IObservable<T> source, ICommand command)
Summary: Executes a command with each value the sequence produces.
Type parameters
| Name | Description |
|---|---|
T | The type of the value offered as the command parameter. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The sequence driving the executions. |
command | ICommand | The command to execute. |
Returns: IDisposable -- A disposable that, when disposed, stops executing the command.
Remarks
The command is the caller's own object rather than a property to observe, so there is nothing here for the
generator to resolve and no dispatch is emitted for this overload.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or command is null. |
2. Overload¶
public static IDisposable InvokeCommand<T, TTarget>(this IObservable<T> source, TTarget? target, Expression<Func<TTarget, ICommand?>> commandProperty, string commandPropertyExpression = "", string callerFilePath = "", int callerLineNumber = 0) where TTarget : class
Summary: Executes the command a property holds with each value the sequence produces.
Type parameters
| Name | Description |
|---|---|
T | The type of the value offered as the command parameter. |
TTarget | The type declaring the command property. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The sequence driving the executions. |
target | TTarget? | The object declaring the command property. |
commandProperty | Expression | An expression that selects the command property to execute. |
commandPropertyExpression = "" | string | The caller argument expression for commandProperty. Auto-populated by the compiler. |
callerFilePath = "" | string | The source file path of the caller. Auto-populated by the compiler. |
callerLineNumber = 0 | int | The source line number of the caller. Auto-populated by the compiler. |
Returns: IDisposable -- A disposable that, when disposed, stops executing the command and stops observing the property.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | No generated InvokeCommand dispatch matched this call site. Use InvokeCommandUnsafe to resolve the expression at run time. |