Prevent DataGrid scrolling from row binding

I have a DataGrid in which each row contains an ItemControl. Because of this, the grid lines can be very high. If the row is higher than the height of the grid, I cannot scroll to see the rest of the row, because the DataGrid will automatically scroll to the next row. That is, if I look at the top half of row 1, and I click the down arrow in a vertical arrow, it skips the top of row 2. This does not allow me to see the bottom half of row 1. How can I make the DataGrid smoothly scroll through the rows, rather than step by step in a row ?

+4
source share
2 answers

It sounds like you want to disable virtualization. To do this, simply set CanContentScroll to False for ScrollViewer . However, if you have a lot of data in your DataGrid , it can become quite slow if you turn on virtualization, since all DataGridRows will be generated immediately, and not when they are really visible to the user.

 <DataGrid ... ScrollViewer.CanContentScroll="False"> 
+6
source

I ran into this problem when scrolling sticks to lines. Then I came across: fooobar.com/questions/930235 / ...

 <Datagrid .. VirtualizingPanel.ScrollUnit="Pixel" 

basically it sets the scroll to snap to pixels instead of elements. This will ensure smooth scrolling.

+3
source

All Articles