问题
I'm trying to show a "back" button on my (Xamarin.Forms) UWP app when running on a desktop PC. I'm running the following code in the App
's OnLaunched
method:
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
But the back button is not shown.
The line does work on a pure UWP app. But not in Xamarin.Forms.
Is there any additional step needed to get this working?
EDIT
It seems now that when navigating to a new NavigationPage(page)
instead of just the page - that's what creates this problem. Am checking it now.
回答1:
You need to use
MainPage=new NavigationPage(new rootPage).
Then use Navigation.PushAsync
and PopAsync
to get that Back button shown and hidden automatically
来源:https://stackoverflow.com/questions/44661275/appviewbackbuttonvisibility-not-working