0

我在数据绑定方面遇到了一些困难。我有一个BindingList(Of IDataItem),列表中填充了两种类类型,它们都实现了IDataItem接口,但只有一个实现了INotifyPropertyChange接口。你可以猜到我正在使用DataGridView绑定到的控件BindingList来显示数据。我遇到了一个问题,即DataGridView除非重绘控件,否则控件不会反映在后台进行的任何属性更改。

有什么建议么?两个类都需要实现INotifyPropertyChange接口吗?是否BindingList不适用于接口类型,必须使用类类型吗?

4

1 回答 1

0

First, I'm curious why you are sticking 2 different items in the BindingList.

Second, if the class does not implement INotifyPropertyChange, changes will NOT be reflected in your grid.

Third, not sure how the BindingList would work with a interface type. I would think it would inspect the type to see if it implements INotifyProretyChanged, which IDataItem (interface) cannot implement another interface... can it? (EDIT: I think it actually can)

于 2013-09-27T21:35:32.780 回答