当行高于视口时,如何使DataGrid平滑滚动? [英] How can I get a DataGrid to scroll smoothly when the Row is taller than the Viewport?
问题描述
这不仅可以阻止用户查看完整的笔记,但也会导致滚动感觉不舒服,因为它似乎跳动。
有没有办法告诉WPF滚动顺利通过一个长的音符,而不会禁用默认的DataGrid虚拟化?
我相信你正在寻找 VirtualizingPanel.ScrollUnit
附加属性,您可以在DataGrid上设置。
如果将其值设置为 Pixel
而不是默认的项目
,它应该做你想要的。
I have a DataGrid full of notes, and it's possible that a note will be taller then the DataGrid's height. When this happens, if you try and scroll down to read the bottom half of the note, the DataGrid immediately skips to the next row.
This not only prevents users from viewing the full note, but also causes the scrolling to feel choppy because it appears to jump around.
Is there a way to tell WPF to scroll smoothly past a long note without disabling the default DataGrid virtualization?
I believe you are looking for the VirtualizingPanel.ScrollUnit
attached property which you can set on the DataGrid.
If you set its value to Pixel
instead of the default Item
, it should do what you want.
这篇关于当行高于视口时,如何使DataGrid平滑滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!