MasterDetail Page debugging error: CS0263
MasterDetail Page debugging error: CS0263
我定义了一个基本的主细节 page.But 每当我尝试启动模拟器时,我都会收到此错误:
“CS0263 'MainPage' 的部分声明不得指定不同的基数 类”
已经 1 周了,仍然无法解决。我知道这是关于继承,但我该怎么办?有什么想法吗?
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MasterDetail.MainPage">
<MasterDetailPage.Master>
<ContentPage BackgroundColor="White" Title="Master">
<StackLayout >
<StackLayout>
<Frame BackgroundColor="#48b6a6" >
<Image Source="heartbeatt.png" HorizontalOptions="Center"
VerticalOptions="Center"/>
</Frame>
</StackLayout>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<ContentPage>
<StackLayout>
<Label Text="Detail"></Label>
</StackLayout>
</ContentPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
cs 文件在这里
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace MasterDetail
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
}
这就是问题所在
public partial class MainPage : ContentPage
在 XAML MainPage 中是 MasterDetailPage
,而不是 ContentPage
。改为这样做
public partial class MainPage : MasterDetailPage
这正是错误消息告诉您的内容:“不得指定不同的基数 类”
我定义了一个基本的主细节 page.But 每当我尝试启动模拟器时,我都会收到此错误: “CS0263 'MainPage' 的部分声明不得指定不同的基数 类” 已经 1 周了,仍然无法解决。我知道这是关于继承,但我该怎么办?有什么想法吗?
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MasterDetail.MainPage">
<MasterDetailPage.Master>
<ContentPage BackgroundColor="White" Title="Master">
<StackLayout >
<StackLayout>
<Frame BackgroundColor="#48b6a6" >
<Image Source="heartbeatt.png" HorizontalOptions="Center"
VerticalOptions="Center"/>
</Frame>
</StackLayout>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<ContentPage>
<StackLayout>
<Label Text="Detail"></Label>
</StackLayout>
</ContentPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
cs 文件在这里
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace MasterDetail
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
}
这就是问题所在
public partial class MainPage : ContentPage
在 XAML MainPage 中是 MasterDetailPage
,而不是 ContentPage
。改为这样做
public partial class MainPage : MasterDetailPage
这正是错误消息告诉您的内容:“不得指定不同的基数 类”