I have the following XAML for Silverlight 3:
<ItemsControl MaxHeight="400"
VirtualizingStackPanel.VirtualizationMode="Recycling" >
<ItemsControl.Template>
<ScrollViewer>
<ItemsPresenter />
</ScrollViwer>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<!-- All my item stuff -->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
But I find I get a bunch of the following errors whenever I scroll:
System.Windows.Data Error: BindingExpression path error:
'ItemDescription' property not found on 'MyObject' 'MyObject' (HashCode=4187856).
BindingExpression: Path='ItemDescription' DataItem='MyObject' (HashCode=4187856);
target element is 'System.Windows.Controls.TextBlock' (Name='');
target property is 'Text' (type 'System.String')..
This goes away if I turn off Recycling. Anyone got a clue how to prevent this?