Skip to content

,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)

View source

Summary: Executes a command with each value the sequence produces.

Type parameters

NameDescription
TThe type of the value offered as the command parameter.

Parameters

NameTypeDescription
sourceIObservableThe sequence driving the executions.
commandICommandThe 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

TypeCondition
System.ArgumentNullExceptionsource 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

View source

Summary: Executes the command a property holds with each value the sequence produces.

Type parameters

NameDescription
TThe type of the value offered as the command parameter.
TTargetThe type declaring the command property.

Parameters

NameTypeDescription
sourceIObservableThe sequence driving the executions.
targetTTarget?The object declaring the command property.
commandPropertyExpression>An expression that selects the command property to execute.
commandPropertyExpression = ""stringThe caller argument expression for commandProperty. Auto-populated by the compiler.
callerFilePath = ""stringThe source file path of the caller. Auto-populated by the compiler.
callerLineNumber = 0intThe 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

TypeCondition
System.InvalidOperationExceptionNo generated InvokeCommand dispatch matched this call site. Use InvokeCommandUnsafe to resolve the expression at run time.