Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prism.Windows - hardware back button press is not firing the BackRequested event first #867

Closed
sakthivelrajarethinam opened this issue Dec 6, 2016 · 6 comments
Labels

Comments

@sakthivelrajarethinam
Copy link

I have two pages in my application PageA navigates to PageB. In PageB, I am handling the BackRequested event to dismiss a popup (shown as a control) and not going back to PageA. I have specified e.Handled = true.

When the user is in PageB and presses back button on device, onNavigatedTo in PageA is getting executed first then it comes to BackRequested event. So I am not able to prevent the user from going back to PageA.

Can you please let me know how to handle this without going to previous pages OnNavigatedTo?

Thank you,
Sakthivel R

@briannoyes
Copy link
Contributor

I think the only way currently you could address that is by disabling the back button in PageB until it is willing to allow the navigation to proceed. The docs show a similar approach here:
https://msdn.microsoft.com/en-us/library/windows/apps/mt465734.aspx

We have actually had a long standing issue to try to address this:
#46

Unfortunately none of us has had the time to dig into addressing that one, which I think would address your scenario as well.

We always welcome community PRs with a solution!

@Mr1Penguin
Copy link
Contributor

Short-term solution is use IDeviceGestureService.GoBackRequested instead of SystemNavigationManager.GetForCurrentView().BackRequested. But PrismApplication class does not check e.Handled inside its OnGoBackRequested. I can create PR for it.

@sakthivelrajarethinam
Copy link
Author

@Mr1Penguin, Thanks a lot for your contribution. Have you created PreRelease already? if yes, can you provide me the details?

Thank you,
Sakthivel R

@Mr1Penguin
Copy link
Contributor

@rsvsakthi
PR = Pull Request. And it's already merged with main branch (#1019).

@brianlagunas
Copy link
Member

Closing this since it was fixed in PR #1019

@lock
Copy link

lock bot commented Jan 29, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants