Hi,
I have a performance problem with the (WPF Toolkit) DataGrid. It contains about 1.000 rows (only eight columns) and scrolling is horribly slow and laggy. Also the initial load of the Window containing the DataGrid takes 5-10 seconds.
I did some research (using google and StackOverflow) but couldn't find anything besides the advice to turn on UI virtualization. But even after explictly enabling that scrolling continues to be awfully slow.
My DataGrid is bound to an ICollectionView / CollectionViewSource. It's is defined in XAML like this (the columns are explicitly defined, not auto generated):
<tk:DataGrid x:Name="dataGrid"
ItemsSource="{Binding Path=Bookings}"
AutoGenerateColumns="False"
Grid.Row="1"
EnableRowVirtualization="True"
EnableColumnVirtualization="True"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
...
</tk:DataGrid>
The DataContext for the entire Window is set to an instance of the class containing the ICollectionView the DataGrid is bound to.
Every blog or forum post I found was praising the DataGrid's performance so I'm quite obviously doing something seriously wrong. Since I'm quite new to WPF in general and especially to the DataGrid I've no clue of how to improve this. Does anybody have some advice for me? What's your experience with the DataGrid? What am I doing wrong?
Edit: Just followed this question's advice to set the Width of all columns to "Auto". That did not change the bad scrolling performance. Also I'm not using DataGridTemplateColumns (just some DataGridTextColumns and two DataGridComboBoxColumns).
Edit2: I used Snoop to look at my app. What I see suggests that virtualization is indeed working (only 19 rows, not a thousand). But every row contains 52 elements, so those add up to more than thousand elements. Might that be a / the problem?
Thanks a lot!