带有AlternatingRowBackground的WPF Datagrid在上下滚动时的滚动方式有所不同

Iva*_*anH 2 wpf scroll row wpfdatagrid alternating

当我向上滚动行颜色时,我有一个带有AlternatingRowBackground的WPF(在Win7上为4.0)数据网格,当我向下滚动颜色时,数据在移动。是平常的吗?是否有可能摆脱这种奇怪的行为?

网格XAML:

<DataGrid AutoGenerateColumns="True"
                      CanUserAddRows="False"
                      Grid.Row="0" Grid.Column="0"  Name="grdData" 
                      ItemsSource="{Binding Path=.}" SelectionMode="Single"
                      HeadersVisibility="All" 
                      AlternatingRowBackground="LightGray" 
                      />
Run Code Online (Sandbox Code Playgroud)

注意:我还有其他关于滚动的问题(当滚动到end时,WPF Datagrid会向上滚动一点),但是我不确定是否连接了问题。

oba*_*lis 5

添加EnableRowVirtualization="False"到您的数据网格。