I've been using the WPF DataGrid a fair bit recently, and wrestling with a number of performance issues. My use case is a DataGrid bound to an ICollectionView, displaying 1,000 rows with 10 autogenerated columns.
Scrolling was nice and smooth but it was taking approximately 20 seconds to render the DataGrid, and a similar amount of time to sort the data after clicking on a column header (way longer than my target 0.1s - 1s response time)
Stack Overflow suggested turning on virtualisation by setting EnableRowVirtualization and EnableColumnVirtualization to True:
<DataGrid EnableRowVirtualization="True" EnableColumnVirtualization="True">
This resulted in the DataGrid rendering almost immediately. Unfortunately every row was blank and there were no columns.
Puzzled, I started removing parts of my xaml one by one to see if something else I was doing was causing the problem. Eventually I removed a DataGrid.GroupStyle I had added and - presto! - the DataGrid rendered quickly and correctly.
It turns out that although you can use GroupStyles to group data in a DataGrid, doing so disables virtualisation. Moreover, if you explicitly set EnableColumnVirtualization="True" too, you'll get the weird rendering behaviour I observed.
Fortunately, Microsoft added the IsVirtualizingWhenGrouping property in .NET 4.5 to address just this problem:
Unfortunately, as of August 2013, under certain conditions this would cause the application to freeze when scrolling through the grid. I tried to reproduce the problem while writing this post, but was unable to do so, so it's possible that it has now been addressed.
In my case, however, I realised that I had added the GroupStyle earlier in the development of my application, but that I no longer needed it. Because EnableRowVirtualization defaults to True anyway, all I had to do was remove the xaml for the GroupStyle and rendering was quick again.
The only remaining niggle is that if rapidly scrolling down the rows, the scroll thumb takes a fraction of a second to catch up to the mouse pointer. Unfortunately this seems to be an unavoidable side-effect of using virtualisation, where the only permitted scroll mode is item-by-item ("logical scrolling") rather than pixel-by-pixel ("physical scrolling"). If we do anything to force the DataGrid to use physical scrolling (such as setting the DataGrid's attached property ScrollViewer.CanContentScroll to false), we disable virtualisation and are back to the DataGrid taking 20 seconds to render again.