简体   繁体   English

如何用设置值填充Devexpress.LookUpEdit?

[英]How to fill a Devexpress.LookUpEdit with set values?

I have a Devexpress LookUpEdit that I want to fill with 2-3 values. 我有一个Devexpress LookUpEdit,我想用2-3个值填充。 For example "Value 1" (1) and "Value 2" (2). 例如“值1”(1)和“值2”(2)。 I want this name to be displayMember of the LookUpEdit and the number in brackets be the valueMember so that if I was given the number 1 I know to set the selected value of the LookUpEdit to "Value 1". 我希望此名称为LookUpEdit的displayMember,括号中的数字为valueMember,这样,如果给我数字1,则知道将LookUpEdit的选定值设置为“值1”。

You should make a class with two properties, then bind a set of instances of it to the LookUpEdit. 您应该创建一个具有两个属性的类,然后将其一组实例绑定到LookUpEdit。
You can then set the LookUpEdit's DisplayMember and ValueMember properties. 然后,您可以设置LookUpEdit的DisplayMemberValueMember属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM