Xamarin forms: The equivalent of .Finish()

那年仲夏 提交于 2019-12-11 02:46:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!