为什么在为列表视图项模板和列表背景色设置背景色时,Xamarin Forms Listview 选定项背景色丢失?
XAML
<ListView x:Name="CorrecpondencesListView"
ItemsSource="{Binding Correspondences}"
HasUnevenRows="True" CachingStrategy="RecycleElement"
ItemSelected="OnSelectSingleCorrecpondences"
SeparatorColor="{StaticResource lightGrey}"
IsPullToRefreshEnabled="True"
SelectionMode="Single"
BackgroundColor="{DynamicResource DynamicBackgroundColor}"
Refreshing="ListView_Refreshing">
<ListView.ItemTemplate>
<DataTemplate>
<controls:CustomViewCell SelectedItemBackgroundColor="#F3F3F3" >
<ViewCell.View>
<Grid Padding="10,10,10,10" RowSpacing="2" BackgroundColor="{DynamicResource DashboardItemsDarkSurface}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</ViewCell.View>
</controls:CustomViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
答案 0 :(得分:0)
当我停止设置 ListView 背景颜色时问题已解决。