}},System.Func{ReactiveUI.IInteractionContext{--2,--3},System.Threading.Tasks.Task})} }},System.Func{ReactiveUI.IInteractionContext{--2,--3},System.IObservable{--4}})}
InteractionBinderImplementation.BindInteraction(TViewModel?, TView, Expression>>, Func, Task>) method¶
Defined in
Type: InteractionBinderImplementation
Namespace: ReactiveUI.Reactive
Assembly: ReactiveUI.Reactive.dll
Applies to
net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471
Overloads¶
- 1.
public IDisposable BindInteraction<TViewModel, TView, TInput, TOutput>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, IInteraction<TInput, TOutput>>> propertyName, Func<IInteractionContext<TInput, TOutput>, Task> handler) where TViewModel : class where TView : class, IViewFor - 2.
public IDisposable BindInteraction<TViewModel, TView, TInput, TOutput, TDontCare>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, IInteraction<TInput, TOutput>>> propertyName, Func<IInteractionContext<TInput, TOutput>, IObservable<TDontCare>> handler) where TViewModel : class where TView : class, IViewFor
1. Overload¶
Attributes: [RequiresUnreferencedCode("Dynamic observation uses reflection over members that may be trimmed.")]
public IDisposable BindInteraction<TViewModel, TView, TInput, TOutput>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, IInteraction<TInput, TOutput>>> propertyName, Func<IInteractionContext<TInput, TOutput>, Task> handler) where TViewModel : class where TView : class, IViewFor
Inherited documentation
These docs were inherited from IInteractionBinderImplementation. The member doesn't override them on this type.
Summary: Binds an interaction on the specified view model to a handler on the view, enabling the view to respond to interaction requests from the view model.
Type parameters
| Name | Description |
|---|---|
TViewModel | The type of the view model containing the interaction property. |
TView | The type of the view that will handle the interaction. Must implement [IViewFor](# |
TInput | The type of the input parameter for the interaction. |
TOutput | The type of the output parameter for the interaction. |
Parameters
| Name | Type | Description |
|---|---|---|
viewModel | TViewModel? | The view model instance containing the interaction property. Can be null if the view is not currently bound to a view model. |
view | TView | The view that will handle the interaction. Must not be null. |
propertyName | Expression | An expression identifying the interaction property on the view model to bind. Must not be null. |
handler | Func | A delegate that handles the interaction when it is triggered. Receives the interaction context and returns a Task representing the asynchronous operation. Must not be null. |
Returns: IDisposable -- An IDisposable that can be disposed to unbind the interaction and release associated resources.
Remarks
This method enables the view to observe and handle interaction requests initiated by the view model, typically for user-driven workflows such as dialogs or prompts. The returned IDisposable should be disposed when the binding is no longer needed to prevent memory leaks. This method uses reflection and may not be compatible with trimming tools; see the RequiresUnreferencedCodeAttribute for details.
2. Overload¶
Attributes: [RequiresUnreferencedCode("Dynamic observation uses reflection over members that may be trimmed.")]
public IDisposable BindInteraction<TViewModel, TView, TInput, TOutput, TDontCare>(TViewModel? viewModel, TView view, Expression<Func<TViewModel, IInteraction<TInput, TOutput>>> propertyName, Func<IInteractionContext<TInput, TOutput>, IObservable<TDontCare>> handler) where TViewModel : class where TView : class, IViewFor
Inherited documentation
These docs were inherited from IInteractionBinderImplementation. The member doesn't override them on this type.
Summary: Binds an interaction from a view model to a handler in the view, enabling the view to respond to interaction requests from the view model.
Type parameters
| Name | Description |
|---|---|
TViewModel | The type of the view model containing the interaction property. |
TView | The type of the view implementing the IViewFor interface. |
TInput | The type of the input parameter for the interaction. |
TOutput | The type of the output parameter for the interaction. |
TDontCare | The type of the value produced by the handler observable. This value is ignored. |
Parameters
| Name | Type | Description |
|---|---|---|
viewModel | TViewModel? | The view model instance containing the interaction property. Can be null if the view is not currently bound to a view model. |
view | TView | The view that will handle the interaction. Must not be null. |
propertyName | Expression | An expression identifying the interaction property on the view model to bind. |
handler | Func | A function that handles the interaction by processing the interaction context and returning an observable sequence. The result of the observable is ignored. |
Returns: IDisposable -- An IDisposable that can be disposed to unbind the interaction and release associated resources.
Remarks
This method uses reflection to observe the specified interaction property, which may be affected by code trimming. The handler is invoked each time the interaction is triggered by the view model. Disposing the returned IDisposable will detach the handler and stop observing the interaction.