DataGrid 中的对象不会触发它们所在的 BindingList 中的 ListChanged 事件
我已经阅读了几乎所有有关 DataGrid、BindingList
和 ListChanged
的 Stackoverflow 问题,但仍然没有答案。
我有一个名为 Invoice : INotifyPropertyChanged
的对象,它有一个 BindingList
由多个 InvoiceLine : INotifyPropertyChanged
对象组成。
现在,当在绑定到 BindableList
的 DataGrid
中时,我将 InvoiceLine
的属性之一更改为 PropertyChanged< /code> 事件已触发,但
BindableList
上未触发 ListChanged
事件。
InvoiceLines 的初始化如下:
this.InvoiceLines = new BindingList<InvoiceLine>();
this.InvoiceLines.ListChanged += new System.ComponentModel.ListChangedEventHandler(InvoiceLines_ListChanged);
this.InvoiceLines.RaiseListChangedEvents = true;
this.InvoiceLines.AllowEdit = true;
I have read pretty much all Stackoverflow questions about DataGrid, BindingList<T>
and ListChanged
and still have no answer.
I have an object called Invoice : INotifyPropertyChanged
, that has a BindingList<InvoiceLine> : INotifyPropertyChanged
that consists of number of InvoiceLine : INotifyPropertyChanged
objects.
Now when in the DataGrid
that is bound to the BindableList<InvoiceLine>
I change one of the properties of a InvoiceLine
a PropertyChanged
event is fired but ListChanged
event is not fired on the BindableList<InvoiceLine>
.
InvoiceLines is initialized like this:
this.InvoiceLines = new BindingList<InvoiceLine>();
this.InvoiceLines.ListChanged += new System.ComponentModel.ListChangedEventHandler(InvoiceLines_ListChanged);
this.InvoiceLines.RaiseListChangedEvents = true;
this.InvoiceLines.AllowEdit = true;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论