How do you switch pages in Xamarin.Forms?

后端 未结 13 1208
我在风中等你
我在风中等你 2020-12-02 07:08

How do you switch between pages in Xamarin Forms?

My main page is a ContentPage and I don\'t want to switch to something like a Tabbed Page.

I\'ve been abl

相关标签:
13条回答
  • 2020-12-02 07:58

    In Xamarin we have page called NavigationPage. It holds stack of ContentPages. NavigationPage has method like PushAsync()and PopAsync(). PushAsync add a page at the top of the stack, at that time that page page will become the currently active page. PopAsync() method remove the page from the top of the stack.

    In App.Xaml.Cs we can set like.

    MainPage = new NavigationPage( new YourPage());

    await Navigation.PushAsync(new newPage()); this method will add newPage at the top of the stack. At this time nePage will be currently active page.

    0 讨论(0)
提交回复
热议问题