Orc.Wizard
Orc.Wizard copied to clipboard
Alt+F4 calls WizardPageViewModelBase.CancelAsync
Please check all of the platforms you are having the issue on (if platform is not listed, it is not supported)
- [x] WPF
- [ ] UWP
- [ ] iOS
- [ ] Android
- [ ] .NET Standard
- [x] .NET Core
Component
WizardWindow / WizardViewModel
Version of Library
4.2.0 / 4.3.0
Version of OS(s) listed above with issue
win10
Steps to Reproduce
- Override the
CancelAsync
method on anyWizardPageViewModel
(e.g.SkillsPageViewModel
) - Navigate to the target page and press Alt + F4
Expected Behavior
The behavior is identical to the one used for the CancelCommand
- that is the WizardPageViewModel.CancelAsync
is only called after the user confirms the cancellation (by default).
Actual Behavior
The CancelAsync
on the WizardPageViewModel
is called before the confirmation dialog is displayed (from the respective CancelAsync
method on the WizardViewModel
).
The problem is that the CancelViewModelAync
initiated by the DiscardChangesAsync
method on the DataWindow
triggers the CancelingAsync
event, to which the child view model responds first, before returning to the top level CancelAsync
method (where the confirmation code lies).
The quick-and-dirty solution I came up with is to override the DiscardChangesAsync
on my (custom) WizardWindow
, executing the CancelCommand
instead of directly calling the CancelViewModelAsync
method
Great find. We should indeed fix this in the WizardWindow. Interested in a PR?
Sure, I'll look into it..
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.