【问题标题】:What's keeping BindingList from subscribing to the PropertyChanged event?是什么阻止了 BindingList 订阅 PropertyChanged 事件?
【发布时间】:2014-02-13 09:55:46
【问题描述】:

我已将 DataGridView.Source 属性设置为 BindingList<T>,其中 T 实现了 INotifyPropertyChanged。

但它不起作用,当我单步执行代码时,我确实发现没有任何东西订阅 PropertyChanged 事件。如何让 BindingList 订阅此事件

【问题讨论】:

    标签: c# datagridview inotifypropertychanged


    【解决方案1】:

    经过 30 分钟的搜索,我自然会在发布问题 5 秒后自行解决。

    我在MyClass 上实现了INotifyPropertyChanged,但实际上我使用的是BindingSource<IMyClass>,而IMyClass 并没有继承INotifyPropertyChanged。一旦我修复它就可以了。

    【讨论】:

    • 我刚刚遇到了同样的问题,谢谢!我想提一下,如果您在另一个实现 INotifyPropertyChanged 的​​类的子类中创建 BindingList ,也会发生这种情况。我仍然必须将 INotifyPropertyChanged 直接添加到 MyClass
    • 太棒了,当我多年前写的东西对某人有所帮助时,我喜欢它! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-23
    • 1970-01-01
    • 2011-02-05
    • 2011-04-30
    • 1970-01-01
    • 2011-12-11
    • 1970-01-01
    相关资源
    最近更新 更多