【发布时间】:2010-12-09 05:38:02
【问题描述】:
我以为这是一个简单的问题,但我在网上找不到任何信息。我正在使用 BindingSource 将 ListBox 绑定到 List,如下所示:
List<Customer> customers = MyMethodReturningList();
BindingSource customersBindingSource = new BindingSource();
customersBindingSource.DataSource = customers;
customersListBox.DataSource = customersBindingSource;
现在,当我在customers 列表中添加或删除时,我的ListBox 会更新(即使没有在BindingSource 上使用ResetBindings),但如果我更改列表中的任何客户对象,它确实会不是。调用ResetBindings 无效。我什至实现了自己的BindingList,但行为没有改变。Customer 类使用属性来访问和修改数据。它的ToString() 内容显示在列表中。
我在 .Net 2.0 中使用 C#。
有什么想法吗?
谢谢
【问题讨论】:
标签: data-binding listbox c#-2.0