阻止ComboBox在数据源更改时更新显示的文本

时间:2015-12-19 22:23:55

标签: c# winforms combobox datasource bindinglist

我有一个绑定到BindingList的ComboBox。 背景是我希望有一个选项可以从下拉列表中选择(作为建议),但如果ItemsSource发生变化,我不想更改显示的文本(例如,当我' m将项添加到BindingList)。

有没有办法阻止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 
}

0 个答案:

没有答案