How do you switch pages in Xamarin.Forms?

后端 未结 13 1249
我在风中等你
我在风中等你 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:55

    Xamarin.Forms supports multiple navigation hosts built-in:

    • NavigationPage, where the next page slide in,
    • TabbedPage, the one you don't like
    • CarouselPage, that allows for switching left and right to next/prev pages.

    On top of this, all pages also supports PushModalAsync() which just push a new page on top of the existing one.

    At the very end, if you want to make sure the user can't get back to the previous page (using a gesture or the back hardware button), you can keep the same Page displayed and replace its Content.

    The suggested options of replacing the root page works as well, but you'll have to handle that differently for each platform.

提交回复
热议问题