不能将类型隐含地转换为' Xamarin.Forms.Page'

时间:2016-09-27 12:07:12

标签: xamarin xamarin.forms

我有一个Xamarin Forms项目,我更新了Xamarin,这是新的App.cs

public App()
{
    // The root page of your application
    var content = new ContentPage
    {
        Title = "Proje1",
        Content = new StackLayout
        {
            VerticalOptions = LayoutOptions.Center,
            Children = {
                new Label {
                    HorizontalTextAlignment = TextAlignment.Center,
                    Text = "Welcome to Xamarin Forms!"
                    }
                }
         }
    };

    MainPage = new NavigationPage(content);
}

我收到此错误

  

无法隐含转换类型' Proje1.Views.View1'到' Xamarin.Forms.Page'

当我做这个

MainPage = new View1();

之前我指的是这样,现在我应该如何在App.cs中设置初始页面?

1 个答案:

答案 0 :(得分:1)

我认为Packages以某种方式从View1继承,所以您需要将其嵌入到ContentView中,以便适合用作Page

Application.MainPage