WPF Performance Issues with very large #s of columns

Dec 3, 2010 at 4:27 AM

I am working on a pivot table implementation linking three DataGrids together on a screen.  In certain configuration of the pivot, the table can be very large (10k x 50 or 50 x 10k if you flipped the axes).  I've been working on this problem all week and I've tried a lot of ways to interact with the pivot and I'm running into some severe problems.

Right now the biggest issue is that for the column pivot and the details pivot in a 10k x 50 configuration, I have to currently call .Columns.Add(new DataGridTextColumn()) with a binding to the underlying formatted cell text (to be retrieved when the cell is virtualized.  So I have to add 20k columns whenever a user flips the table, and I have to do it in the UI thread, causing real headaches with trying to keep the application responsive to the user.  In the release notes for the grid there's this quote "For DataGrid, this means that performance in scenarios with hundreds or thousands of columns will be greatly improved."  I have been unable to find any additional information.  Please advise.

Currently I create dynamic types with get properties C0 .. CN which are then reached by binding.  One issue right now is that I have to create differently named dynamic types for each configuration of the pivot since the properties have to change.  Ideally I'd tell the control # of columns and have it request data via a callback with the row object and the column index requested, at which point I could create/retrieve the underlying data cell's data and pipe it over to a singleton data template.  

Let me know if you'd like further details or code.