How do you switch pages in Xamarin.Forms?

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

    In the App class you can set the MainPage to a Navigation Page and set the root page to your ContentPage:

    public App ()
    {
        // The root page of your application
        MainPage = new NavigationPage( new FirstContentPage() );
    }
    

    Then in your first ContentPage call:

    Navigation.PushAsync (new SecondContentPage ());
    

提交回复
热议问题