I have a LookUpEdit which I'm binding to a variable of an enumerated type. I'm then setting the datasource of the lookup to the list of values like so:
lookUpEdit.Properties.DataSource = Enum.GetValues( typeof( EnumType ) );
The problem is that the enumerations have multiple words, which I've separated with an underscore. I'd like them to show up in the dropdown with spaces instead of underscores. I'm doing this in the CustomDisplayText and that works fine when the dropdown isn't showing, but I'd like it to work for the items in the dropdown as well.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Dov,
Thanks for your question. The LookUpEdit doesn't allow you to customize text within the pop-up window. I suggest that you use the ImageComboBoxEdit rather than the LookUpEdit, and use the ImageComboBoxEdit.Properies.Items.AddEnum method to populate items and customize each Item.Description property as your needs dictate.
Please let me know whether this solution meets your requirements.
Thanks,
Uriah.
That definitely works, but why is it that I have to use an ImageComboBox for the AddEnum functionality? That doesn't seem too intuitive. Might I request that a similar feature be added to the normal ComboBox? Or perhaps a renaming of the ImageComboBox class?
Hello Dov,
<<< why is it that I have to use an ImageComboBox for the AddEnum functionality
You can use the ComboBoxEdit for this purpose. Please write this code to populate its items from the enumeration:
comboBoxEdit.Properties.Items.AddRange(Enum.GetValues(typeof(EnumType)));
<<< Might I request that a similar feature be added to the normal ComboBox
I believe that it isn't necessary. The ImageComboBoxItemCollection has the AddEnum method because populating it from enumeration isn't as easy as for the ComboBoxItemCollection.
<<< Or perhaps a renaming of the ImageComboBox class?
Unfortunately, we can't do this, because this is a breaking change and I'm afraid that most of our customers won't appreciate it.
Please feel free to contact us again if you experience any difficulty when using our product.
Thanks,
Uriah.
But a ComboBoxItem doesn't have a Description property in addition to the Value property, right? Why is that the case?
Hello Dov,
Sorry, I have missed it. The ComboBox isn't suitable for this purpose. The best approach is to use the ImageComboBox.
Thanks,
Uriah.
May I request, then, that the AddEnums method and the Description property be added to the ComboBox as a future feature?
Hello Dov,
Certainly, you can request for implementing this functionality. We'll count the number of customer votes and consider implementing it in the future. However, I believe that the ImageComboBoxEdit is the best editor in your situation. Could you please explain why the ImageComboBoxEdit component doesn't meet your requirements? Probably, I can suggest an appropriate approach for you to use.
I'm look forward to hearing from you.
Thanks,
Uriah.