3

I am using the .NET 4 WPF DataGrid and notice poor vertical scrolling performance when using a large number of columns. Here is what i did to test this:

  1. Enable Virtualization (VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling")
  2. Embed the DataGrid in a simple Grid layout and there are no other controls in this window
  3. The columns have no custom formatting, no images - just simple text
  4. I am running on a pretty good computer. win7(64-bit) on quad core 3.2gz with 8gb ram and radeon 7800 series card
  5. Tests with Perforator don't show anything bad like software rendering, etc

Here are some results:

  • 100 rows x 5 cols : Smooth scrolling
  • 100,000 rows x 5 cols : Smooth scrolling
  • 100 rows x 75 cols : Very poor scroll performance
  • 100,000 rows x 75 cols : Completely frozen

What can i do to improve vertical scrolling performance when i have a large number of columns (~75 - 100)?

Thanks

1
  • Does 75 columns make sense, even it it worked flawlessly? I suggest using only important columns by default and showing an alphabetically sorted list of optional columns as checkboxes to the side of a grid which can be made visible on request by user. Commented Jul 7, 2012 at 23:16

1 Answer 1

5

You are missing two very important properties:

Enable both of them and see if that makes a difference. It should help.

I have about 20 or so columns with about 2,500 rows and I haven't see performance issues, but it 75 columns definitely seems like a lot. You might want to investigate adding a right-click enable/disable columns in the header (similar to excel).

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you. These 2 properties helped a lot. Disabling virtualizingstackpanel and enabling these two properties made a big difference. I am now able to manage 75 cols x 10,000 rows. My app is an excel like app and users typically choose between 75 - 150 columns out of a total of 300. They extend the app across multiple monitors. Hence, this example is actually a real life scenario. This change now works for upto 90 columns. Wonder if there is a way i can make it work for 150. Thank you for your help
@Rhino, I have the same situation, do you mean the workaround is EnableColumnVirtualization="True" EnableRowVirtualization="True" VirtualizingStackPanel.IsVirtualizing="False" ? In my case it almost stops, scrolls very slow
thanks @daub815 for response, but what you mean "turn off the stackpanel virtualizing for the pane"? do you mean change itempanel to stackpanel expect of virtualized onr?
@ArsenMkrt I would need to see the rest of your xaml to understand the difference between this question and yours. Perhaps you should post another stackoverflow question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.