Open brianlagunas opened 3 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
I think we'd make this work by wiring up through the OnBackPressedDispatcher
thought with https://github.com/dotnet/maui/pull/22869 looking I think we'd just override OnBackPressed on the dialog? Or perhaps the expectation is still to use OnBackPressedDispatcher
now
This issue has been verified using Visual Studio 17.11.0 Preview 2.1(8.0.61). Can repro on Android platform.
Description
Using a custom Window class, when hooking into the Window.ModalPopping event, setting the
e.Cancel = true
causes the app to close when the Android hardware button is pressed for a modal navigation stack.The offending code can be found in the App.xaml.cs file
Steps to Reproduce
What I expect to happen is for the modal view to not be popped, and the app to stay running on screen.
For more context, the Prism Library uses a custom Window to take control of the navigation process on a go back for the modal navigation stack. We need to cancel the built-in popping that is invoked by the hardware back button, and use our pop code instead. This gives us the ability to prevent a navigation based on our
IConfirmationRequest
interface. If the result of ourIConfirmationRequest
istrue
we will do the pop modal again, if the result isfalse
, we will not pop the modal and keep the user on the current view.Link to public reproduction project repository
https://github.com/brianlagunas/WindowModalPoppingBug
Version with bug
8.0.61 SR6.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android API 34
Did you find any workaround?
No
Relevant log output
No response