我正在使用Microsoft在本页提供的样式来设置DataGrid
的样式。 我不会更改此样式,只剩下一行,如下所示,它启用了备用的行背景色。
<!--Style and template for the DataGrid.-->
<Style TargetType="{x:Type DataGrid}">
<Setter Property="AlternationCount" Value="2"/>
... and the rest of the style
我意识到这种风格非常奇怪。 当您向上/向下滚动数据网格几次后,您会看到混合的备用行后颜色! 如下面的图片:
我期望在滚动之前是正确的浅色和深色行序列; 但是滚动后,所有内容都是随机混合的。 在应用这种样式之前,我在DataGrid
定义中明确设置了替代行颜色,如下所示,这是我从未经历过的行为。
<DataGrid ItemsSource="{Binding Source={StaticResource itemsSource}}" AutoGenerateColumns="False" AlternatingRowBackground="#FF58C9FD" RowBackground="#00000000"/>
有没有人建议我应该在哪里寻找问题?