The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

Interaction<TInput, TOutput> Class

Summary

Represents an interaction between collaborating application components.
Namespace
ReactiveUI
Base Types
  • object
graph BT Type-->Base0["object"] Type["Interaction<TInput, TOutput>"] class Type type-node

Syntax

public class Interaction<TInput, TOutput>

Remarks

Interactions allow collaborating components in an application to ask each other questions. Typically, interactions allow a view model to get the user's confirmation from the view before proceeding with some operation. The view provides the interaction's confirmation interface in a handler registered for the interaction.

Interactions have both an input and an output. Interaction inputs and outputs use generic type parameters. The interaction's input provides handlers the information they require to ask a question. The handler then provides the interaction with an output as the answer to the question.

By default, handlers are invoked in reverse order of registration. That is, handlers registered later are given the opportunity to handle interactions before handlers that were registered earlier. This chaining mechanism enables handlers to be registered temporarily in a specific context, such that interactions can be handled differently according to the situation. This behavior can be modified by overriding the Handle(TInput) method in a subclass.

Note that handlers are not required to handle an interaction. They can choose to ignore it, leaving it for some other handler to handle. The interaction's Handle(TInput) method will throw an UnhandledInteractionException<TInput, TOutput> if no handler handles the interaction.

Type Parameters

Name Description
TInput The interaction's input type.
TOutput The interaction's output type.

Constructors

Name Summary
Interaction(IScheduler?) Initializes a new instance of the Interaction<TInput, TOutput> class.

Methods

Name Value Summary
GetHandlers() Func<InteractionContext<TInput, TOutput>, IObservable<Unit>>[]
Gets all registered handlers by order of registration.
Handle(TInput) IObservable<TOutput>
Handles an interaction and asynchronously returns the result.
RegisterHandler(Action<InteractionContext<TInput, TOutput>>) IDisposable
Registers a synchronous interaction handler.
RegisterHandler(Func<InteractionContext<TInput, TOutput>, Task>) IDisposable
Registers a task-based asynchronous interaction handler.
RegisterHandler<TDontCare>(Func<InteractionContext<TInput, TOutput>, IObservable<TDontCare>>) IDisposable
Registers an observable-based asynchronous interaction handler.

Extension Methods

Name Value Summary
BindCommand<Interaction<TInput, TOutput>, TViewModel, TProp, TControl, TParam>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<Interaction<TInput, TOutput>, TControl>>, Expression<Func<TViewModel, TParam?>>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindCommand<Interaction<TInput, TOutput>, TViewModel, TProp, TControl, TParam>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<Interaction<TInput, TOutput>, TControl>>, IObservable<TParam?>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindCommand<Interaction<TInput, TOutput>, TViewModel, TProp, TControl>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<Interaction<TInput, TOutput>, TControl>>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindValidation<Interaction<TInput, TOutput>, TViewModel, TViewModelProperty, TViewProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty>>, Expression<Func<Interaction<TInput, TOutput>, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds the specified ViewModel property validation to the View property.
BindValidation<Interaction<TInput, TOutput>, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<Interaction<TInput, TOutput>, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<Interaction<TInput, TOutput>, TViewModel, TViewProperty>(TViewModel?, Expression<Func<Interaction<TInput, TOutput>, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds the overall validation of a ViewModel to a specified View property.
BindValidation<Interaction<TInput, TOutput>, TViewModel, TViewProperty>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, Expression<Func<Interaction<TInput, TOutput>, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds a ValidationHelper from a ViewModel to a specified View property.
BindValidation<Interaction<TInput, TOutput>, TViewModel>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<Interaction<TInput, TOutput>, TViewModel>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidationEx<Interaction<TInput, TOutput>, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidationEx<Interaction<TInput, TOutput>, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
InvokeViewModelAction<T>(Action<T>) object
This is a thing I lifted from Prism.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T8>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T9>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T10>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T11>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T12>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T8>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T9>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T10>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T11>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T8>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T9>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T10>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T8>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T9>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T8>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6, T7>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T7>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5, T6>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T6>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4, T5>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T5>?>>, Func<T1?, T2?, T3?, T4?, T5?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3, T4>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T4>?>>, Func<T1?, T2?, T3?, T4?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2, T3>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T3>?>>, Func<T1?, T2?, T3?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet, T1, T2>(Expression<Func<Interaction<TInput, TOutput>, IObservable<T1>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<T2>?>>, Func<T1?, T2?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Observe a observable which is set to a property, and automatically subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<Interaction<TInput, TOutput>, TRet>(Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>, Expression<Func<Interaction<TInput, TOutput>, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
With<Interaction<TInput, TOutput>, TKey, TField>(Dictionary<TKey, TField>, IDictionary<TKey, TField>) TBuilder
Adds the specified dictionary to the provided dictionary.