How do you switch pages in Xamarin.Forms?

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

    Push a new page onto the stack, then remove the current page. This results in a switch.

    item.Tapped += async (sender, e) => {
        await Navigation.PushAsync (new SecondPage ());
        Navigation.RemovePage(this);
    };
    

    You need to be in a Navigation Page first:

    MainPage = NavigationPage(new FirstPage());
    

    Switching content isn't ideal as you have just one big page and one set of page events like OnAppearing ect.

提交回复
热议问题