C # UWP Windows 10
Actually a subject: In Windows Phone 8 applications it was possible to use NavigationManager
. How to programmatically call GoBack()
in Windows 10 applications?
C # UWP Windows 10
Actually a subject: In Windows Phone 8 applications it was possible to use NavigationManager
. How to programmatically call GoBack()
in Windows 10 applications?
Moving to another page is done in much the same way as in WP8:
this.Frame.Navigate(typeof(SettingsPage));
In order to go back you can do this:
Frame rootFrame = Window.Current.Content as Frame; if (rootFrame.CanGoBack) { rootFrame.GoBack(); }
Please note that the "Back" button of the window can be displayed or hidden like this:
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = ((Frame)sender).CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
Well, you can add handling of the event of clicking on this button:
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
rootFrame
and you need to imitate pressing the back button - SYLContent
. The back button calls OnBackRequested
in App.cs. There may be its own processing that will replace the windows (for example, the PIN input window on SplitView) So the current window has rootFrame.CanGoBack = false
- always - SYLSource: https://ru.stackoverflow.com/questions/510109/
All Articles