views:

152

answers:

0

I have a very simple test application where I have two objects, each with a small collection of items. when I select an object I display its collection in a WPFToolkit DataGrid.

The problem is there is a noticeable delay, such that if you press up/down keys to toggle selection between objects you can see it can't keep up.

Why is the performance so bad?

<Window x:Class="SlowGridBinding.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    Title="MainWindow" Height="350" Width="525">
<StackPanel>
    <ListBox ItemsSource="{Binding Shops}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True"/>
    <Controls:DataGrid ItemsSource="{Binding Shops/Vegetables}" AutoGenerateColumns="True"/>
</StackPanel>

The DataContext is populated with some test classes filled with 50 items of random test data.