Horrible lag on display

May 20, 2009 at 5:21 PM

I have a datagrid on tab control.  Basically this datagrid is used as my log window.  There are about 8 text columns.  I run the program until there are about 300-500 messages in the window.  When I switch to the tab item for the first time the entire UI hangs for about 5-10 seconds!  What I can I do about this?  Any ideas would be appreciated.  I've already asked about this in the msdn forums but was informed that the datagrid is not a microsoft supported product. (what a load of crap)

May 20, 2009 at 10:48 PM

Could you point me to the MSDN forum post?  Also, now that .NET 4.0 Beta 1 has been released, if you do this in a 4.0 application (where DataGrid is in the Framework) then I think that would clear up the issue of "supported or not" since I believe the Beta is considered "supported."  I'm not positive about that, but you could try. :-)

Anyway, let's see if we can clear this up for you here.  Some quick ideas: Do you have virtualization turned on?  (DataGrid.EnableRowVirtualization=true and there's no grouping applied?)  Are you making any of the layout mistakes mentioned in this post: http://wpf.codeplex.com/Thread/View.aspx?ThreadId=53930?  Are you using * column widths?  If so, try setting those to absolute widths or SizeToCells, SizeToHeader, or Auto - we've had some bugs reported with star width columns in TabControl.  None of those helping?  If you could create an Issue and post a simple repro project, we could take a look at it to see if we can find anything else that's going wrong.


May 21, 2009 at 11:17 AM


Thanks for the fast response!  Here is the MSDN post. http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cd26c8c8-84cf-4230-a8e6-6af71272a681/

As for VS 2010/.NET 4 Beta 1, I did download and install the beta on seperate machine to play with.  The problem is that even if .NET 4 solves the performance issue it won't solve my problem.  The WPF UI I'm working on is part of product that is shipping in a month or so.  I will go over your suggestions and see if that helps.  If it doesn't I'll try to build a small repro project.  Thanks.


May 21, 2009 at 6:47 PM

Thanks Jon.  Ok, let me know if any of the suggestions work for you and if not, send over the repro.  In reference to the .NET 4 thing, I just meant that if anyone on MSDN says it's not a supported control, you can likely retort with "it's in the .NET 4.0 Beta, so now it should be." :-)  The DataGrid in 4.0 is actually the exact same control as is in the Toolkit (give or take a few bug fixes which could only be done in the framework), so if you find a solution which works on 4.0, chances are it *should* also work for you in 3.5 SP1.