[WPF] Cancel command bound to a button #369
mujahidislam
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All, Im struggling to implement logic for cancelling a reactive command generated by source generators. Basically I have following in my view model
[ReactiveCommand(CanExecute = nameof(CanLogin))] private async Task LoginAsync(CancellationToken cancellationToken)And in my view I have bind this command to a button as below
this.BindCommand(ViewModel, vm => vm.LoginCommand, v => v.LoginButton) .DisposeWith(disposables);However I cant find a way to cancel the cancellationToken on lets say when user click "Cancel" button. Would appreciate if team here can suggest an elegant way to do so, the one I can think of is creating another composite command but thats unnecessary additional command and will need to be done in every view model and every command I need it. I was hoping reactive command could expose an API for cancelling it.
Beta Was this translation helpful? Give feedback.
All reactions