我想將我的XAML ViewCell與c#對應關聯起來,並將它與listview一起使用。 WeatherCell.xamlViewcell XAML + CS拋出構建動作'Page'不受支持錯誤
<?xml version="1.0" encoding="utf-8" ?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="cell"
x:Class="UI.WeatherCell">
<ViewCell.View>
<StackLayout Orientation="Vertical" Padding="10">
<Label Text="WeatherCell"
x:Name="TempLabel"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Label Text="WeatherCell"
x:Name="LocationLabel"
VerticalOptions="Center"
HorizontalOptions="Center" />
</StackLayout>
</ViewCell.View>
</ViewCell >
WeatherCell.cs
namespace UI
{
public partial class WeatherCell : ViewCell
{
public WeatherCell()
{
InitializeComponent();
}
}
}
在MainPage.cs簡稱如下
this.WeatherListView.ItemsSource = Weather.Weather.DataFactory.genForecast();
this.WeatherListView.ItemTemplate = new DataTemplate(typeof(WeatherCell));
在建設,我得到錯誤的
'Page' is not supported by the specific combination of the project's targets. \WeatherCell.xaml.
我guesss w ^作爲x:Class =「UI.WeatherCell」將鏈接xaml和cs。我究竟做錯了什麼?