我有一个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中设置初始页面?
答案 0 :(得分:1)
我认为Packages
以某种方式从View1
继承,所以您需要将其嵌入到ContentView
中,以便适合用作Page
。
Application.MainPage