Issue
I defined a basic master detail page.But whenever I try to start emulator, I am getting this error: "CS0263 Partial declarations of 'MainPage' must not specify different base classes" Its been 1 week and still couldnt solve it. I know it is about inheritance but what should I do ? Any ideas?
<?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 file here
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();
}
}
}
Solution
this is the problem
public partial class MainPage : ContentPage
in the XAML MainPage is a MasterDetailPage
, not a ContentPage
. Do this instead
public partial class MainPage : MasterDetailPage
this is exactly what the error message is telling you: "must not specify different base classes"
Answered By - Jason
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.