问题
I have a Xamarin Forms application which very well on all three platforms. The app has a login screen and other pages that are available one a user has successfully logged in. My question is: In Xamarin Forms; is there a way to have the equivalent of the Finish method that Xamrin for Android provides to remove the login page from the navigation stack? If a user keeps pressing the back button they eventually get back to the login screen which is undesirable. I have tried using Navigation.PopAsync () but seem not to work
回答1:
Navigation.PopAsync
and Navigation.RemovePage
should definitely work.
BUT if your page is also a MainPage
you can't remove it. You could change it to another page using this code:
App.Current.MainPage = new NavigationPage(new MyContentPage());
来源:https://stackoverflow.com/questions/32035997/xamarin-forms-the-equivalent-of-finish