我在我的视图中有这个ItemsControl:
<ItemsControl
ItemsSource="{Binding ItemPageItemViewModels}"
ItemTemplate="{StaticResource ItemPageItemViewModelsTemplate}"/>
而在此之上,我有一个数据模板来渲染所有项目:
<DataTemplate x:Key="ItemPageItemViewModelsTemplate">
<TextBlock Text="{Binding Title}"/>
</DataTemplate>
问题在于,尽管我的ViewModel中的ObservableCollection中有8个对象,但屏幕上只显示最后一个对象8次。
我可以在ViewModel中设置断点来查看ObserverableCollection中确实有8个不同的对象,但是我如何调试绑定以查看为什么这个DataTemplate会在我的屏幕上将集合中的最后一个对象呈现8次?