Hi
I have a Winforms project, in which I have an UltraComboEditor. Some of the items that are represented in the UltraComboEditor are marked in a special way, to indicate that they are not in use. This is done when populating the items of the UltraComboEditor like so:
if (/*Some condition*/) { comboTrees.Items[index].Appearance.ForeColor = SystemColors.InactiveCaptionText; comboTrees.Items[index].Appearance.FontData.Strikeout = DefaultableBoolean.True; }
This gives a nice indication when the list is dropped down. Now, when an item is selected, I would like to keep that formatting, if it was not in use.
SubjectTree1, which is not in use, was selected - but when selected, it is not possible to see that it is not in use.
The only way I can achieve this is by setting the appearance for the entire UltraComboBox, making it look like all the items are not in use. Is there a way to only format the SelectedItem of an UltraComboEditor?
Best regards
Lars
Hi Lars,
The ComboEditor will not pick up the appearance of the text of the selected item. But it will pick up the image. So if you applied an image to each ValueListItem and used an image to indicate which ones are not in use, then that image would display when that item is selected.
Another option, of course, is to trap when the selected item changes and apply an appearance to the control's edit area.
Hi Mike,
Thanks for your reply! We use this indication (with the strikeout and fontcolor) other places in the application when items are not in use, so adding images is not an option at the moment.
I am already handling the ValueChanged event of the ComboEditor to update other parts of the screen, so it would be natural to update the editor here as well. Can you tell me how to retrieve the edit area of the control? I have looked at the "ComboEditor.Editor" property, but there doesn't seem to be any options to alter the appearance.
Best regards,
Hi Mike.
Thanks again for your quick reply. I switched to the UltraCombo, and now I have the desired apperance in the selected item.
I couldn't get your sample project to run, though. Might be because we use an older version (v11.2), but even after selecting the corresponding assemblies and updating the license-file, it still wouldn't run. But the important stuff was in the code anyway, and from that it was easy to tweak my own code to get the result.
Thanks again!
To my surprise, the ComboEditor doesn't have an EditAppearance property. I thought it did. The Appearance property affects the list, as well, so you can't use that, either.
So my recommendation is to use UltraCombo instead of UltraComboEditor. The Appearance of this control doesn't affect the list, only the edit area.To make sure it works, I whipped up a small sample project which demonstrates how to do it and I have attached it here.