Add support for commands as well as events.
Description
I propose we add support for commands in the control and not just hook onto events. We can still keep the events for backwards compatibility.
The Why
This would allow users to further decouple their views from their models. It allows for easy integration into projects that use the MVVM design pattern.
The How
It's something I'll have to a little further into but from what I know it should be fairly straightforward; just add a few ICommand properties to the control and call the Execute function when they need to be executed.
To be honest, thinking about this more - there is always EventBinder to accomplish this as a workaround. Happy to close if no one really wants this feature.
This can be done easily with the Reactive Linq extensions, or ReactiveMarbles code generator libs.
// Reactive Linq extensions
using ReactiveUI;
using static System.Reactive.Linq.Observable;
<snip>
this.WhenActivated(d => {
FromEvent<TimeSpan>(handler => GlWpfControl.Render += handler,
handler => GlWpfControl.Render -= handler)
.WhereNotNull()
.Select(_ =>Unit.Default)
.InvokeCommand(ViewModel.DrawCmd)
.DisposeWith(d);
});