【发布时间】:2010-11-10 02:57:49
【问题描述】:
我的视图中有这个 ItemsControl:
<ItemsControl
ItemsSource="{Binding ItemPageItemViewModels}"
ItemTemplate="{StaticResource ItemPageItemViewModelsTemplate}"/>
在它上面我有这个渲染所有项目的 DataTemplate:
<DataTemplate x:Key="ItemPageItemViewModelsTemplate">
<TextBlock Text="{Binding Title}"/>
</DataTemplate>
问题是,虽然我的 ViewModel 中的 ItemPageItemViewModels ObservableCollection 中有 8 个对象,但只有 last 对象被在屏幕上显示 8 次。
我可以在我的 ViewModel 中设置一个断点来查看 ObserverableCollection 中确实有 8 个不同的对象,但是我如何调试绑定来查看为什么这个 DataTemplate 会呈现最后一个集合中的对象在我的屏幕上出现 8 次?
【问题讨论】:
-
你看过这个话题吗? stackoverflow.com/questions/337023/…
标签: wpf debugging mvvm binding observablecollection