0
votes

So, I've recently come onto a project where they're using a standard .NET WPF DataGrid, using Grouping to build out several items underneath each respective group, and the scrollbar is acting very unusual.

I've noticed that it seems like it's getting confused about the size of the elements entirely. It doesn't scroll via the pixel size of the elements -- it scrolls to the size of the Groupings, it looks like. I don't know if there's an implicit style going on in the backend of the project, but I was wondering:

Is there a way to make the WPF DataGrid scroll by pixels of the total size and maintain that position, rather than aligning to the content via Groups?

1

1 Answers

2
votes

You should try setting ScrollViewer.CanContentScroll="False" on your DataGrid. However, be aware that this will disable Row virtualization.