WinForm下的DevExpress中ComboxEdit怎么绑定key/value值
1个回答
展开全部
我引用一下官网的示例
每一个Item是一个Object对象,所有你可以把数组赋值给它
ComboBoxEdit combo = new ComboBoxEdit();
ComboBoxItemCollection coll = combo.Properties.Items;
coll.BeginUpdate();
try {
coll.Add(new PersonInfo("Sven", "Petersen"));
coll.Add(new PersonInfo("Cheryl", "Saylor"));
coll.Add(new PersonInfo("Dirk", "Luchte"));
coll.Add(new object[] {"你要填的值","局陆随便什么值"});
}
finally {
coll.EndUpdate();
}
combo.SelectedIndex = -1;
Controls.Add(combo);
//...
public class PersonInfo 咐察{
private string _firstName;
private string _lastName;
public PersonInfo(string firstName, string lastName) {
_firstName = 衡腊茄firstName;
_lastName = lastName;
}
public override string ToString() {
return _firstName + " " + _lastName;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询