2017-12-22 24 views
-2

私はこれを試してみたが、言った:ListViewのアイテムの色とフォントサイズを変更するにはどうすればいいですか?

私はあなたのリストビューのレイアウトを作成するためにViewCellを使用することをお勧め

var template = new DataTemplate(typeof(TextCell)); 
template.SetBinding(TextCell.TextColorProperty,Color.Black); 
+0

pl問題を適切に説明してください。あなたが何を求めているのかは分かりません。 – Shuvra

+0

私はアイテムとしてもTextCellを持っているListviewを持っています。私はTextCellのTextColorを変更する必要があります。なぜなら、デフォルトでは赤色であるからです。 – KosovoDev

+0

公式ガイドを確認してください:https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/customizing-cell-appearance/公式の文書でうまくカバーされている非常に基本的な質問をしています。 – EvZ

答えて

0

Xamarin.Forms.BindingBaseするXamarin.Forms.Colorから変換できません

customizing-cell-appearance

<?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="demoListView.ImageCellPage"> 
    <ContentPage.Content> 
     <ListView x:Name="listView"> 
      <ListView.ItemTemplate> 
       <DataTemplate> 
        <ViewCell> 
         <StackLayout BackgroundColor="#eee" 
         Orientation="Vertical"> 
          <StackLayout Orientation="Horizontal"> 
           <Image Source="{Binding image}" /> 
           <Label Text="{Binding title}" 
           TextColor="#f35e20" /> 
           <Label Text="{Binding subtitle}" 
           HorizontalOptions="EndAndExpand" 
           TextColor="#503026" /> 
          </StackLayout> 
         </StackLayout> 
        </ViewCell> 
       </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 
    </ContentPage.Content> 
</ContentPage> 
+0

それは問題です!私はC#でデータを処理する必要があります。なぜなら、データはjsonファイルから来るからです。 – KosovoDev

+0

C#とXAMLの両方をカバーする公式ガイドです。 – EvZ

+0

?? Jsonファイル?それは「束縛」です。あなたはC#またはXAMLでプロパティをバインドできます... Jsonそれは問題ではありません。 –

関連する問題