2016-09-07 3 views
1

XAML ViewCellをc#の相手とリンクしてlistviewで使用しようとしています。 WeatherCell.xamlViewcell XAML + CS throwsビルドアクション '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私は

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

マイguesssとしてエラーが出る構築する際

this.WeatherListView.ItemsSource = Weather.Weather.DataFactory.genForecast(); 
this.WeatherListView.ItemTemplate = new DataTemplate(typeof(WeatherCell)); 

を次のようにMainPage.csに呼ば

namespace UI 
{ 
    public partial class WeatherCell : ViewCell 
    { 
     public WeatherCell() 
     { 
      InitializeComponent(); 
     } 
    } 
} 

w x:Class = "UI.WeatherCell"は、xamlとcsの両方をリンクします。私は間違って何をしていますか?

答えて

1

WeatherCell.xamlのビルドアクションを変更すると、問題が解決されました。

それはEmbeddedResource

ビルドアクションプロパティに設定する必要がありますが、ファイルのプロパティのコンテキストメニューで見つけることができます。

0

xamlファイルを右クリックし、[プロパティ]をクリックします。 [プロパティ]でEmbedded Resourceを選択します。 プロジェクトを再構築します。

関連する問題