I have a Combo in DropDownList mode and when the item is selected it shows it in blue. Im aware this is the operating Systems setting for selected text but i would like to know if there is any other way to not have it like that.
Im going for the DropDownButton look to some degree but dont know how to achieve it. Any Help is appreciated.
You could use the IUIElementDrawFilter interface to take over the drawing for that element (Infragistics.Win.EditorWithTextDisplayTextUIElement). In your case you would want to handle the BeforeDrawBackColor drawing phase, fill the background with the color you want to use,. and return true to indicate that it was handled.
Hi Brian, I have searched but im not experience in this area and arnt sure what to look for, if you were to help me solve it i will compensate you for your time.
Cheers
i would like to offer a fix to who ever want to simply cancel this for no color and find out there are other phases to ignore on the way
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { return DrawPhase.BeforeDrawBackColor | DrawPhase.BeforeDrawBorders | DrawPhase.BeforeDrawFocus; }
also make sure that Color.Empty is not being replaced on the consructor...
Ok i got it ;-) Cheers Brian
I hate to be a bugger, but i couldnt convert this to VB in any converter, any chance you would be able to show the VB version?
P.S i will contact the sales dep and tell them why im paying them and because of your helping me.
Make the check payable to "Infragistics, Inc." :)
this.ultraComboEditor.DropDownStyle = DropDownStyle.DropDownList;this.ultraComboEditor.DrawFilter = new SelectionColorDrawFilter( Color.Red );
public class SelectionColorDrawFilter : IUIElementDrawFilter{ Color selectionColor = Color.Empty; public SelectionColorDrawFilter( Color selectionColor ) { this.selectionColor = selectionColor.IsEmpty == false ? selectionColor : SystemColors.Highlight; }
#region IUIElementDrawFilter Members
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { if ( drawParams.Element is Infragistics.Win.EditorWithTextDisplayTextUIElement ) { using ( SolidBrush brush = new SolidBrush(this.selectionColor) ) { drawParams.Graphics.FillRectangle( brush, drawParams.Element.RectInsideBorders ); }
return true; }
return false; }
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { return DrawPhase.BeforeDrawBackColor; }
#endregion}