4

I have this ItemsControl in my View:

<ItemsControl 
    ItemsSource="{Binding ItemPageItemViewModels}"
    ItemTemplate="{StaticResource ItemPageItemViewModelsTemplate}"/>

And above it I have this DataTemplate which renders all the items:

<DataTemplate x:Key="ItemPageItemViewModelsTemplate">
    <TextBlock Text="{Binding Title}"/>
</DataTemplate>

The problem is that although there are 8 objects in the ItemPageItemViewModels ObservableCollection in my ViewModel, only the last object is being displayed on the screen 8 times.

I can set a breakpoint in my ViewModel to see that there are indeed 8 different objects in the ObserverableCollection, but how can I debug the binding to see why this DataTemplate is rendering the last object in the collection 8 times upon my screen?

Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
  • 1
    Have you seen this topic? http://stackoverflow.com/questions/337023/how-to-detect-broken-wpf-data-binding – billb Jul 12 '09 at 16:30

1 Answers1

4

See Bea Stollnitz's excellent article about this.

Cameron MacFarland
  • 70,676
  • 20
  • 104
  • 133