Hello,
With the .NET ComboBox, I can bind a generic List of our objects (e.g. List<Customer>) as its datasource (not setting DisplayMember / ValueMember) and the text displayed for each object is its overriden ToString() method.
With the UltraComboEditor, I bind the same list of objects (still not setting DisplayMember / ValueMember), but the text that is displayed for each object is its class name.
Is there a built-in way I can get the UltraComboEditor to behave like the .NET ComboBox and display each object using its ToString() method?
If not, is there a way I can inherit from the UltraComboEditor and take advantage of an override to display each bound object using its ToString() method?
Thanks,David McClelland
OK, so I dug through the UltraComboEditor's source code that we have, and it turns out that specifying the DisplayMember and ValueMember as:
Infragistics.Win.BindableValueList.USE_LISTOBJECT_AS_VALUEMEMBER
... does the trick! This is noted in the documentation for the UltraComboEditor's ValueMember property, but not in the documentation for the DisplayMember property.
I'm so glad I found this - I do hope in the future this behavior can be made a property of the UltraComboEditor so that it's more visible to developers.
- David McClelland
Hi David,
You should not have to set USE_LISTOBJECT_AS_VALUEMEMBER. I ran your sample and it works fine for me. So you must be using an old version and what you are seeing is a bug. How to get the latest service release - Infragistics Community
USE_LISTOBJECT_AS_VALUEMEMBER