Question: Window.Closed and separate before/after close events
See original GitHub issueMicrosoft.UI.Xaml.Window
has a Closed
event but no Closing
/BeforeClose
/CloseRequested
/etc events. Inspecting WindowEventArgs
, it appears to have a Handled
property, which indicates that this event is actually called prior to the window actually closing (or else it wouldn’t be settable).
Shouldn’t the name for this event be Close
or CloseRequested
and not Closed
(past tense)? Is there any interest in specifying two separate events with one being tentative (a close was requested) and another being actual (the form is closing and there’s nothing you can do about it) à la SWF/WPF, to simplify the handling?
The problem is evident when there are multiple independent observers of Window.Closed
and one randomly sets the “handled” flag. Depending on the call order, other observers may or may not see the handled state and be left thinking that the window has closed when it hasn’t.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Can we plan to fix this properly for 2.0 and not hide behind “API change is hard”? The major increment will give you cover.
They added AppWindow.Closing since, to cancel or not closing