简体   繁体   中英

CS1729 'MyNavigationPage' does not contain a constructor that takes 1 arguments --> in visual studio 2019 community edition

I am trying to add a navigation bar in Xamarin.forms

    public App()
    {
        InitializeComponent();
        MainPage = new MyNavigationPage(new MyNavigationPage());
    }

I am getting this error --> 'MyNavigationPage' does not contain a constructor that takes 1 argument

I have tried adding a constructor but then the navigation bar does not appear.

The answer was, we have to use the pre-build method "NavigationPage" instead of your own created page ie in my cast MyNavigationPage

new NavigationPage(new MyNavigationPage());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM