2017-12-22 17 views
-2

나는 이것을 시도하지만, 말했다 :색상 및 FontSize ListView 항목의 변경하는 방법?

난 당신의 ListView의 레이아웃을 만들 수 ViewCell를 사용하는 것이 좋습니다

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

pl 문제를 적절하게 설명하기 쉽습니다. 당신이 무엇을 요구하고 있는지 확실하지 않습니다. – Shuvra

+0

ListView에 항목으로 TextCell이 있는데, 기본적으로 빨간색이므로 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은 문제가 아닙니다. –