Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Viewcell XAML+;CS抛出构建操作';第'页;此错误不受支持_Xaml_Xamarin - Fatal编程技术网

Viewcell XAML+;CS抛出构建操作';第'页;此错误不受支持

Viewcell XAML+;CS抛出构建操作';第'页;此错误不受支持,xaml,xamarin,Xaml,Xamarin,我试图将我的XAML ViewCell与c#对应程序链接起来,并与listview一起使用。 WeatherCell.xaml <?xml version="1.0" encoding="utf-8" ?> <ViewCell xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

我试图将我的XAML ViewCell与c#对应程序链接起来,并与listview一起使用。 WeatherCell.xaml

<?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 >
在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.

我猜测x:Class=“UI.WeatherCell”将链接xaml和cs。我做错了什么?

更改WeatherCell.xaml的构建操作修复了该问题

必须将其设置为
EmbeddedResource


可以在文件属性上下文菜单中找到生成操作属性。

右键单击xaml文件,然后单击属性。 在属性下选择嵌入式资源
。
重建您的项目

'Page' is not supported by the specific combination of the project's targets. \WeatherCell.xaml.