我有这个列表视图,但我不知道如何设置节标题的样式。如何在Xamarin中完成?没找到任何东西
<ListView x:Name ="listView"
IsGroupingEnabled="true"
GroupDisplayBinding="{Binding sectionHeader}"
HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal" Padding="10">
<StackLayout Orientation="Vertical">
<Label Text="{Binding Title1}" FontSize="12" FontAttributes="Bold"/>
<Label Text="{Binding Title2}" FontSize="12" FontAttributes="Bold"/>
<Label Text="{Binding SubTitle}" FontSize="12"/>
</StackLayout>
<Image Source="new_feedback_0.png" HorizontalOptions="EndAndExpand"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
答案 0 :(得分:1)
您需要在ViewCell
中使用DataTemplate
<ListView x:Name ="listView"
IsGroupingEnabled="true"
<!--GroupDisplayBinding="{Binding sectionHeader}" Not Needed anymore since you are providing your own GroupHeaderTemplate for the group header view-->
HasUnevenRows="true">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding sectionHeader}" TextColor="Red" FontAttributes="Italic" />
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
...
</ListView.ItemTemplate>
</ListView>
。 E.g:
for sublist in np_combined:
if max(sublist) > 5:
plt.plot(times,sublist,color = 'blue')
else:
plt.plot(times,sublist,color = 'orange')
现在您可以根据需要设置标签样式。