Datagrid: Adding templated columns runtime, performance

Oct 31, 2008 at 4:47 PM

First, thank you for a very promising control!

We have a scenario where the number of columns in a datagrid is unknown at designtime and may be very large (1000+). Because of this we dynamically add new DataGridTemplateColumns runtime (with a DataTemplate as CellTemplate), either by building XAML-strings and parsing them with XamlReader or alternatively by using FrameworkElementFactory to build the datatemplates.

We also set EnableColumnVirtualization to true, but do not know the consequences of this.

Our problem is that when the number of columns reach 250, the hit on performance is quite unacceptable (10 seconds+ just to build the columns). Populating an already built grid with new rows is not a problem.

Any ideas on alternative solutions?