我正在以Xamarin Forms(XAML/C#)开发一个新应用。我在XAML页面中有一个带有标题的表视图部分。如何更改仅表格部分的背景颜色?我可以在所有表观视图中更改它,但是我只想更改表部分的颜色。我是新手开发的,有没有简单的解决方案?谢谢你
这是XAML解决方案(背景部分):
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Silver">
<Grid Padding="5" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label Text="{Binding Title}"
FontSize="Medium"
FontAttributes="Bold"
TextColor="Black"
VerticalOptions="CenterAndExpand"
LineBreakMode="WordWrap"
BackgroundColor="Red"
/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>