このエラーメッセージが繰り返し表示されます。部分宣言で異なる基本クラスを指定してはいけません。誰かが私にこれの原因となるかもしれないことを教えてもらえますか?ここに私のコードです。部分宣言で異なる基本クラスを指定してはならない
CashAdvancePage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ebmsMobile.CashAdvancePage"
Title="Cash Advance"
BackgroundImage="bg3.jpg">
<Label Text="This is the Cash Advance Page." VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>
CashAdvancePage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ebmsMobile
{
public partial class CashAdvancePage : ViewCell
{
public CashAdvancePage()
{
//InitializeComponent();
//NavigationPage.SetHasNavigationBar(this, false);
var image = new Image
{
HorizontalOptions = LayoutOptions.Start
};
image.SetBinding(Image.SourceProperty, new Binding("ImageUri"));
image.WidthRequest = image.HeightRequest = 40;
var nameLayout = CreateNameLayout();
var viewLayout = new StackLayout()
{
Orientation = StackOrientation.Horizontal,
Children = { image, nameLayout }
};
View = viewLayout;
}
static StackLayout CreateNameLayout()
{
var nameLabel = new Label
{
HorizontalOptions= LayoutOptions.FillAndExpand
};
nameLabel.SetBinding(Label.TextProperty, "DisplayName");
var twitterLabel = new Label
{
HorizontalOptions = LayoutOptions.FillAndExpand,
Font = Fonts.Twitter
};
twitterLabel.SetBinding(Label.TextProperty, "Twitter");
var nameLayout = new StackLayout()
{
HorizontalOptions = LayoutOptions.StartAndExpand,
Orientation = StackOrientation.Vertical,
Children = { nameLabel, twitterLabel }
};
return nameLayout;
}
}
}
なぜあなたは.csページでviewcellを継承していますか?私はそれがコンテンツページでなければならないと思う。継承しているクラスは、xamlのルート要素でなければなりません。 –
@Akash Amin私はちょうどそれがContentPageだったインターネット上でそれを見た。しかし、私がContentPageを使用しているとき、 'Xamarin.Forms.View'が '型'であるが、 '変数'のように使用されるというエラーが表示されます。 –
View = viewLayoutの代わりにContent = viewLayoutを使用できます –