being on the last page (in the navigation stack, i.e. there is nowhere else to return), when you press the hardware key, the application crashes, instead of stopping. Is there some way to redefine navigation back in an application with MVVM Framework Prims 6?
2 answers
Apparently, you need to redefine the behavior of the application. The standard that you have researched is configured to collapse when it is impossible to move backwards. And yours - at closing. I do not remember how they are configured, you can find in the help and add my answer
|
You can cancel and override navigation in Prism like this:
deviceGestureService.GoBackRequested += (s, e) => { e.Handled = true; e.Cancel = true; }; But why do you think that the application is falling? After all, this is a regular behavior - to close the application, if there is no place to go back.
- Hmm, I had a regular application before it was such that it rolled up and went to the main screen, and I could return to it. and here it is completely closed, it is terribly inconvenient - Arthur
- and answer one more question, please. Is there extensive documentation on UWP Prism? Otherwise, I found it on a githaba only for WPF and use it, but this is not the best option, for there are significant differences - Arthur
- did not help, it still closes. although when navigating back an event is triggered. - Arthur
- What kind of application? I didn’t see the latest documentation in Russian, I’ll take everything I need here. Github.com/PrismLibrary It’s strange that it’s closed, it shouldn’t. - Make Makeluv
- What are you talking about "What kind of application?" so here is the thing that is strange. the error does not crash into the debugger, so this is not an exception. and when to subscribe to this event? I created a shared App class, inherited from PrismAutofacApplication, and there when I activate I subscribe to this event. But in the debugger I walked, it goes there, and it constantly shows that the navigation stack is empty. Used NavigationService - Arthur
|