【发布时间】:2016-09-19 06:07:05
【问题描述】:
如何在 WPF ItemsControl 中覆盖 PropertyChangedCallback预定义的依赖属性ItemsSource。
我开发了一个继承自 ItemsControl 的 WPF 自定义控件。我使用了预定义的依赖属性 ItemsSource。因为我需要在 Collection 更新后监控和检查数据。
我在谷歌搜索了很多,但我找不到任何相关的解决方案来满足我的要求。
请帮助我,要覆盖的方法名称是什么?...
【问题讨论】:
-
ItemsControl.OnItemsSourceChanged。这在
ItemsSource依赖控件的属性更改回调中调用。这可能不一定是你要找的…… -
@poke 你能指导我,如何监控
Collection更改... -
你可能有更多的运气观察 Items 属性的变化msdn.microsoft.com/en-us/library/… 它实现了 CollectionView 并因此有 CollectionChanged 事件。我不知道它会如何运作。它说 Items 集合在设置 ItemsSource 时是只读的。
标签: c# wpf dependency-properties itemscontrol propertychangelistener