【发布时间】:2016-03-26 08:46:43
【问题描述】:
我有一个绑定到 BindingList 的 ComboBox。 背景是我希望有一个从下拉列表中选择的选项(作为建议),但是如果 ItemsSource 更改(例如,当我将项目添加到绑定列表)。
有没有办法防止 ComboBox 在项目源更改时更新显示的文本?
一些代码:
this.comboBox1.DataSource = database.ListItems; // database.ListItems is of type BindingList<string>
public void update_ListItems(BindingList<string> ListItems)
{
ListItems.Add("Item"); // Causes an update of the displayed text in the ComboBox
}
【问题讨论】:
标签: c# winforms combobox datasource bindinglist