Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

wpf - How can I get a DataGrid to scroll smoothly when the Row is taller than the Viewport?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...