PushAsync is not supported globally on Android, please use a NavigationPage - Xamarin.Forms

前端 未结 9 1478
情歌与酒
情歌与酒 2020-12-12 17:34

I have the following method in an Xamarin.Forms.ContentPage wired to a button click event

public class Lo         


        
9条回答
  •  庸人自扰
    2020-12-12 18:26

    You are calling "PushAsync":

    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
    
        private void btnCourseList_Clicked(object sender, EventArgs e)
        {
            Navigation.PushAsync(new PageB());
        }
    }
    

    but you did not start the NavigationPage, which normally is done in the App.cs class, or at least it should be started before any call to "PushAsync":

    MainPage = new NavigationPage(new PageA());
    

提交回复
热议问题