I'm switching to the latest version of ReactiveUI (7.0) and I'm running into some incompatibilities and would like to know the suggested way to handle this:
ReactiveUI 6.x
Texts.Events().MouseUp
.InvokeCommand(ViewModel, x => x.DoSomething);
This now throws an exception:
Command requires parameters of type System.Reactive.Unit, but received parameter of type System.Windows.Input.MouseButtonEventArgs.
I fixed this by using the following code, but is this the right way?
Texts.Events().MouseUp
.Select(x => Unit.Default)
.InvokeCommand(ViewModel, x => x.DoSomething);
The argument that the command was expection was Unit, meaning a command without an input argument which in the case of ReactiveUI is a ReactiveCommand. Thats why in the example above you have to 'convert' the MouseButtonEventArgs from the event to a Unit. For this I created a helper extension method ToSignal: