Xamarin.forms 为列表视图项目模板和列表背景颜色设置背景颜色时,Xamarin Forms Listview所选项目背景颜色将丢失

Xamarin.forms 为列表视图项目模板和列表背景颜色设置背景颜色时,Xamarin Forms Listview所选项目背景颜色将丢失,xamarin.forms,Xamarin.forms,为什么在设置列表视图项模板的背景色和列表背景色时,Xamarin Forms Listview选定项的背景色会丢失 XAML <ListView x:Name="CorrecpondencesListView" ItemsSource="{Binding Correspondences}" HasUnevenRows="True" CachingSt

为什么在设置列表视图项模板的背景色和列表背景色时,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>


当我停止设置ListView背景色时,该问题已得到修复。

添加您的代码,以便我们确定您的错误所在。感谢您的回复,我一直在为ListView及其项目模板设置背景色。