Any recommendations for improving DataGrid Performance?

Aug 18, 2009 at 11:42 PM

I have a 100 row by 30 column DataGrid that is bound to an ObservableCollection.  I notice that it takes about about 350 msec to update the ObservableCollection when the DataGrid is displayed full screen (about 40 rows and 20 coumns on a 1280 x 800 laptop screen).  Do other people see the same performance?  This seems like a long time to me.

The same ObservableCollection can be updated in about 20 msec when it is not bound to the DataGrid (or 15x faster than the data bound case).   

The DataGrid uses the built-in DataGridTextColumns.  It does not have any fancy stying or custom templates.  It has fixed column widths.  Varying the Binding Mode (1-way vs 2-way) does NOT seem to make any difference.

Can anybody recommend how I can improve the performance of my data bound Datagrid? Can it update in closer to 20 msec than 350 msec?

My DataGrid has:
              ScrollViewer.IsDeferredScrollingEnabled="True"
              VirtualizingStackPanel.IsVirtualizing="True"
              VirtualizingStackPanel.VirtualizationMode="Recycling"

I am running on a Intel Duo T7250 at 2.0 GHz with 2 GB RAM. Screen is 1280x800.
I am using the June 2009 release of the DataGrid with .NET 3.5 SP1.

I can switch the ItemsSource of the DataGrid between various ObservableCollections (100 rows) to update the DataGrid display in about 80 msec.

FWIW, these times are virtually unchanged for an ObservableCollection of 1,000 rows.
The times are approximately doubled for a DataGrid of 60 columns.
This suggests that row virtualization works; but column virtualization does not work yet.  This is what I expected based on the release notes.

Thanks very much for your help,

Sep 1, 2009 at 4:06 PM

Hi,

I tried to post a new discussion about this issue:

http://wpf.codeplex.com/Thread/View.aspx?ThreadId=67598

 

 

Coordinator
Sep 1, 2009 at 9:52 PM

Hi, I've posted a reply on the thread kawone's linked to.

For your question, you need to specifically enable column virtualization on the DataGrid with the EnableColumnVirtualization DP.