滚动时的问题与WPF DataGrid单元格样式 [英] issue with wpf datagrid cell style when scrolling

查看:422
本文介绍了滚动时的问题与WPF DataGrid单元格样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的DataGridCell风格我的WPF的DataGrid(红色边框刷)。当我向下滚动垂直选定的细胞消失这是确定的。当我向上滚动,我看到所选的细胞,但很少有人丢失自己的风格,它出现在错误的细胞。

I created a new DataGridCell style for my wpf datagrid (Red Border brush). When I scroll down vertically the selected cells disappear which is ok. When I scroll up I see the selected cells but few of them missing their style and it appear in wrong cells.

它看起来像数据网格记得选中的单元格,而是忘记自己的风格。

It look like the data grid remember the selected cells but "forget" their style.

任何想法?

哈伊姆

推荐答案

在没有任何更多的细节,我只能猜测,您遇到文物是虚拟化的细胞再利用的结果。您可以通过禁用列和行的虚拟化测试:

Without any more details I can only guess that artifacts you're experiencing are a result of reusing of virtualized cells. You can test this by disabling column and row virtualization:

<DataGrid EnableRowVirtualization="False" EnableColumnVirtualization="False" ...

另外,如果这并不能帮助任何机会做你重写等于您的数据项的方法是什么?当他们显示几个项目等于偶尔ItemsControls故障。

Also, if this doesn't help did you by any chance override the Equals method of your data items? ItemsControls occasionally glitch when they display several equal items.

这篇关于滚动时的问题与WPF DataGrid单元格样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆