我有一个 User 类型的 BindingList,User 对象有几个属性(UserName、Password 等)。所以我将事件处理程序绑定(bind)到 BindingList.ListChanged 事件,在添加或删除用户时它工作正常,但是,如果用户属性发生更改,它不会引发事件,有什么办法可以实现这一点?
bindingListUsers.Add(someUser); // This raises ListChangedEvent
bindingListUsers.Delete(someUser); // This raises ListChangedEvent
bindingListUsers[0].UserName = "Another user name"; // This does NOT raise the event
最佳答案
您的用户类型需要实现 INotifyPropertyChanged
。
关于c# - 属性更改时未引发 BindingList.ListChanged 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/835345/