Hi alexchou,
In this version of the Datagrid, there is no way of improving the speed of the layout, knowing that the virtualization is disabled.
When a column is added, its position and visibility is set relative to other columns, creating a recalculation and repositionning of many columns. If there are many rows and columns (and virtualization is disabled), many cells will be measured at each columns collection changed.
Hiding the column wouldn't affect the render of the DataGrid (just the internal collection data), but showing them later would probably create the same issue.
You could try to set the DataGrid.ItemsSource to null, set the columns collection you want and set the DataGrid.ItemsSource to this new source and may have a faster result, but you would lose the Current selection and other current data.
Again :
-Without a sample, we can't test or debug any possible problems.
-You may try to add the columns at the very beginning of the application, before the Datagrid loads and see how long it takes.
-If the data are complicated or accessed from a server, there could be a delay.
-Maybe your machine could be slow processing the data or visual elements.
-The Full "Xceed DataGrid for WPF" includes a BatchUpdate to modify many columns in one batch. Look for sample "And more/BatchUpdating" in the "ClickOnce App" available here : http://xceed.com/Grid_WPF_Demo.html. The addition of 300 columns takes less than a second.
In this version of the Datagrid, there is no way of improving the speed of the layout, knowing that the virtualization is disabled.
When a column is added, its position and visibility is set relative to other columns, creating a recalculation and repositionning of many columns. If there are many rows and columns (and virtualization is disabled), many cells will be measured at each columns collection changed.
Hiding the column wouldn't affect the render of the DataGrid (just the internal collection data), but showing them later would probably create the same issue.
You could try to set the DataGrid.ItemsSource to null, set the columns collection you want and set the DataGrid.ItemsSource to this new source and may have a faster result, but you would lose the Current selection and other current data.
Again :
-Without a sample, we can't test or debug any possible problems.
-You may try to add the columns at the very beginning of the application, before the Datagrid loads and see how long it takes.
-If the data are complicated or accessed from a server, there could be a delay.
-Maybe your machine could be slow processing the data or visual elements.
-The Full "Xceed DataGrid for WPF" includes a BatchUpdate to modify many columns in one batch. Look for sample "And more/BatchUpdating" in the "ClickOnce App" available here : http://xceed.com/Grid_WPF_Demo.html. The addition of 300 columns takes less than a second.