Skip to content

},System.Linq.Expressions.Expression{System.Func{--0,--3}},System.String)} },System.Linq.Expressions.Expression{System.Func{--0,--3}},System.IObservable{--4},System.String)} },System.Linq.Expressions.Expression{System.Func{--0,--3}},System.Linq.Expressions.Expression{System.Func{--1,--4}},System.String)}

ReactiveUIBindingExtensions.BindCommandUnsafe(TView, TViewModel?, Expression>, Expression>, string?) 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 BindCommandUnsafe<TView, TViewModel, TProp, TControl>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
  • 2. public static IDisposable BindCommandUnsafe<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, IObservable<TParam?> withParameter, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class
  • 3. public static IDisposable BindCommandUnsafe<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, Expression<Func<TViewModel, TParam?>> withParameter, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class

1. Overload

Attributes: [RequiresUnreferencedCode("Evaluates expression-based member chains via reflection; members may be trimmed.")]

public static IDisposable BindCommandUnsafe<TView, TViewModel, TProp, TControl>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class

View source

Summary: Binds a command from a view model to a control on a view.

Type parameters

NameDescription
TViewThe type of the view.
TViewModelThe type of the view model.
TPropThe type of the command property.
TControlThe type of the control.

Parameters

NameTypeDescription
viewTViewThe view to bind to.
viewModelTViewModel?The view model containing the command.
propertyNameExpression>An expression that selects the command property on the view model.
controlNameExpression>An expression that selects the control on the view.
toEventstring?The event name to bind to. If null, a default event is selected.

Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.

Remarks

Resolves the property chain by reflection, for an expression the generator could not read.

2. Overload

Attributes: [RequiresUnreferencedCode("Evaluates expression-based member chains via reflection; members may be trimmed.")]

public static IDisposable BindCommandUnsafe<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, IObservable<TParam?> withParameter, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class

View source

Summary: Binds a command from a view model to a control on a view with an observable parameter.

Type parameters

NameDescription
TViewThe type of the view.
TViewModelThe type of the view model.
TPropThe type of the command property.
TControlThe type of the control.
TParamThe type of the command parameter.

Parameters

NameTypeDescription
viewTViewThe view to bind to.
viewModelTViewModel?The view model containing the command.
propertyNameExpression>An expression that selects the command property on the view model.
controlNameExpression>An expression that selects the control on the view.
withParameterIObservableAn observable that provides the command parameter.
toEventstring?The event name to bind to. If null, a default event is selected.

Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.

Remarks

Resolves the property chain by reflection, for an expression the generator could not read.

3. Overload

Attributes: [RequiresUnreferencedCode("Evaluates expression-based member chains via reflection; members may be trimmed.")]

public static IDisposable BindCommandUnsafe<TView, TViewModel, TProp, TControl, TParam>(this TView view, TViewModel? viewModel, Expression<Func<TViewModel, TProp?>> propertyName, Expression<Func<TView, TControl>> controlName, Expression<Func<TViewModel, TParam?>> withParameter, string? toEvent) where TView : class, IViewFor where TViewModel : class where TProp : ICommand where TControl : class

View source

Summary: Binds a command from a view model to a control on a view with a parameter expression.

Type parameters

NameDescription
TViewThe type of the view.
TViewModelThe type of the view model.
TPropThe type of the command property.
TControlThe type of the control.
TParamThe type of the command parameter.

Parameters

NameTypeDescription
viewTViewThe view to bind to.
viewModelTViewModel?The view model containing the command.
propertyNameExpression>An expression that selects the command property on the view model.
controlNameExpression>An expression that selects the control on the view.
withParameterExpression>An expression that selects the command parameter property on the view model.
toEventstring?The event name to bind to. If null, a default event is selected.

Returns: IDisposable -- A disposable that, when disposed, disconnects the binding.

Remarks

Resolves the property chain by reflection, for an expression the generator could not read.