Performance of WPF DataGrid vs. WinForms DataGridView

Oct 6, 2009 at 11:39 PM
Edited Oct 6, 2009 at 11:40 PM

I have a WPF app with a DataGrid side by side with a Forms app with an equivalent DataGridView. Both grids are using the defaults except I set autogeneratecolumns to true on the WPF one. 

In each grid I load a Linq to Sql table with about 13,000 rows and 20 columns.

The DataGridView is smoking fast - it scrolls instantly and reacts immediately to the mouse. However the DataGrid does not do well. Although it scrolls horizontally fast, the vertical scrolling is really slow - there is a major lag from where I move the mouse to where the scroll bar jumps. I also tried setting the Recycling virtualization mode explicity on the DataGrid but it had no effect. (I set it to Standard and it was even slower - so virtualization is working).

I'm on a 2.6ghz desktop PC with 4GB RAM and Radeon video card. I have also tried this on several other PC's with the same results. WPF seems fast in other respects, but it certainly seems to struggle badly with a large set of data. 

Is this typical or to be expected?


Mar 5, 2010 at 11:06 AM

has there been any progress on this?

I have the same issue as datadebator. I have read a countless number of articles both on codeplex and elsewhere on potential remedies for the slow performance of the wpf datagrid with large datasets (virtualisation, absolute height/width/row height/etc, using Snoop to see what is happening under the hood, using WPF Performance Suite to analyse bottlenecks, etc), without finding any improvement in scrolling performance when implementing the suggestions. when profiling, the hit on performance comes from rendering the basic textblock containers i use which display the data on screen.

i get an obvious lag in scrolling between the mouse position and the position of the scrollbar vertically (for 9000 items with 11 display fields) and the cpu utilisation spikes during this scrolling. it is simply not fit for use for our users and so i have to persist with the datagridview which is incredibly responsive and displays large datasets just fine, but which obviously looks a little out of place in the wpf application we are working on.

i am using XP SP3 on a Core 2 6400 @ 2.13GHz 3.5GB RAM with a Matrox Millennium P650 video card

a basic little example of my xaml for the datagrid which demonstrates the poor scrolling performance is below - i am simply creating a list of objects (with varying string and decimal? properties) in the code behind and binding to the grid as per below in the window1.xaml.cs of a new WPF Application project. any help would be much appreciated.

<Window x:Class="WpfApplication2.Window1" xmlns="" xmlns:x="" Title="Window1" Height="300" Width="800" xmlns:dg=""><Grid><dg:DataGrid x:Name="grid" AutoGenerateColumns="False" IsReadOnly="True" RowHeight="18" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" EnableColumnVirtualization="True" EnableRowVirtualization="True" HeadersVisibility="Column" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"><dg:DataGrid.Columns><dg:DataGridTemplateColumn Header="Field1" IsReadOnly="True" Width="60"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field1}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn Header="Field2" Width="80"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field2}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn Header="Field3" Width="50"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field3}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn Header="Field4" Width="70"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field4}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn Header="Field5" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field5}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t0Column" Header="Field6" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field6}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t1Column" Header="Field7" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field7}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t2Column" Header="Field8" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field8}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t3Column" Header="Field9" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field9}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t4Column" Header="Field10" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field10}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn><dg:DataGridTemplateColumn x:Name="t5Column" Header="Field11" Width="75"><dg:DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock Text="{Binding Field11}" /></DataTemplate></dg:DataGridTemplateColumn.CellTemplate></dg:DataGridTemplateColumn></dg:DataGrid.Columns></dg:DataGrid></Grid></Window>


Mar 8, 2010 at 5:37 PM



Aug 2, 2010 at 10:47 AM

All quiet on the western front it seems and I have come back to this issue because we really want to move wholheartedly into the WPF world but the centrepiece of our apps (i.e. the datagrid) is not acceptable to use in the WPF flavour because of its lack of speed with large datasets. We are still retaining the Winforms grid for the moment because it is much much faster (in scrolling) than its WPF newcomer.

Does anyone have any ideas on this? The above example demonstrates fairly obviously the performance drawback on the WPF grid with a large set of data in terms of scrolling. Please help!

Nov 15, 2010 at 3:25 PM

WPF in .NET Framework 4 has EnableColumnVirtualization and EnableRowVirtualization, which are on by default.  It will not create data grid items until it is visible on the screen (you scroll to it) which can improve performance.  But another way to do this would be to use SQL "data paging" such that you only poll a smaller set from the greater results and then ask for the next or previous set to display when the user hits a button or scrolls past a certain point.

Nov 15, 2010 at 3:48 PM


I'm not sure if this response was supposed to be helpful but it wasn't. The WPF data grid is dog slow no matter how you slice it. As you said we already have virtualization on. And paging the data on SQL server is not relevant since the WinForms datagrid is fast as lightning with the SAME data set.


Oct 25, 2012 at 3:26 PM

I have a same problem till now

We have 110 columns and about 2K rows in our grid, and it works slow, here grid virtualization configuration.


I also try various properties, like turning off virtualization, changing recycling/standard but it doesn't become faster

Winform grid we use is few times faster, Ideally I would like to get excel grid like performance, Is it possible in WPF to extend grid like that?