2017-09-18 26 views
1

コードにFOOSのリストが表示されるかどうかわかりません。正しい項目の詳細ページに移動できるリストアイテムが生成されます。リストアイテムは空白ですまたはすべてのテキストが白です。私はどれを把握することができません。 enter image description hereXAML背景色とテキストの色が変更されない

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      x:Class="MaopApplication.Views.PipelineSearch"> 
    <StackLayout Orientation="Vertical"> 
     <StackLayout Orientation="Horizontal" > 
      <Entry Placeholder="Search With PipelineName" Text="{Binding SearchText}" ></Entry> 
      <Button Text="Search" Command="{Binding SearchPipes}" /> 
     </StackLayout> 
     <ListView ItemsSource="{Binding Foos}" ItemTapped="OnListViewItemTapped" ItemSelected="OnListViewItemSelected"> 
      <ListView.ItemTemplate> 
       <DataTemplate> 
        <ViewCell> 
         <ViewCell.View BackgroundColor="Red"> 
          <StackLayout> 
           <label Text="wtf" TextColor="Black"></label> 
           <label Text="{Binding Test}"TextColor="Black"/> 
          </StackLayout> 
         </ViewCell.View> 
        </ViewCell> 
       </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 
    </StackLayout> 
</ContentPage> 

ここで間違っカップルの事FOOS

var Foos = new List<object>() {new {Test = "foo"}, new {Test = "bar"}};

+0

奇妙な。出力ウィンドウにエラーメッセージが表示されますか?あなたは 'Foos'で記入するコードを投稿できますか? – hvaughan3

+0

エラーはありません。すべて – gh9

+0

リストビューを試すことができますか:VerticalOptions = "FillAndExpand" –

答えて

3

を作成するためのコード(多分それはちょうど悪いコピー/ペースト仕事だった):

  • ViewCell.ViewBackgroundColorプロパティがない場合は、を使用してください私はあなたのコードにこれらの変更を行ったとき代わり
  • labelLabelでなければなりません

を(大文字は重要)、それは私のために細かい走っ:

<ViewCell> 
    <ViewCell.View> 
    <StackLayout BackgroundColor="Red"> 
     <Label Text="wtf" TextColor="Black"/> 
     <label Text="{Binding Test}" TextColor="Black"/> 
    </StackLayout> 
    </ViewCell.View> 
</ViewCell> 
+1

ありがとう – gh9

関連する問題