I would like to know if it is possible to change the highlight color of a selected item in a UltraComboEditor. It is possible to a Windows Forms ComboBox with the attached code. Is the DrawItem method exposed anywhere or what would be the equivalent? Thanks.
Hi,
Could someone give me the c# code to remove the highlight blue color of the combo text "editor", showed when an item is selected or when the combo receives the focus?
The dropdownstyle is DropDownList.
I would like to only see the "rectangle" without highlight color.
thanks,
I'm just following up on this. Is there anything else I can help you with regarding this question?
Which approach are you referring to - using a DrawFilter or using AppStylist?
It's not possible to change the text highlight color when the edit portion of the control is in edit mode. When it's in edit mode, it uses the Microsoft TextBox control and this control does not expose any way to change the highlight color - it always picks it up from the system.
The image you show here must be showing a selected item and then a HotTracked item. It doesn't look like the ValueList exposes the HotTracked item, though. And AppStylist doesn't expose a HotTracked state for the items. So there's no way to do this with UltraComboEditor. You might want to consider using UltraCombo instead, which has a more robust appearance model.
But even with UltraCombo, you can't change the text highlight color, because it also use a TextBox for editing. It depends on the DropDownStyle, though. If you are using DropDownList (in which case the user can only choose from the list and cannot type into the combo), the color can be adjusted.
This works for the drop down menu when something is clicked but when the item is selected it still shows the blue background in the editor as well as highlighting any of the other items. The following is an image of it. Thanks.
https://www.dropbox.com/s/rot1b1chb991jfm/Highlight.png?dl=0
You could use Application Styling to do this:
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win.AppStyling;
using Infragistics.Win.AppStyling.Runtime;
ApplicationStyleLibrary library = new ApplicationStyleLibrary();
StyleSetSettings styleSet = library.StyleSets.Add("Default");
styleSet.RoleStyles.GetStyle("ValueListItem",true).States.GetState(RoleState.Selected,true).Appearance.BackColor = Color.Red;
Also, the ValueList class (returned by a control property of the same) exposes a DrawValueListItem event, which is the equivalent of the ComboBox's DrawItem event.