Hi,
I am trying to figure out how to set the border colour of the UltraCombo. In certain conditions when the user selects the control i want it to change the border colour to red.
Setting the UltraCombo.Appearance.BorderColor = Color.Red doesn't change the border color of the control.
Is there a specific property that needs to be set?
Cheers,Nathan.
Hi Nathan,
There are a number of factors at work here, including the DisplayStyle property. But my guess is that the control is themed by default. Theming is all-or-nothing. So if Themes are on, then whole control is drawn themed and you can't change any individual colors of any of the themed elements.
So you probably have to set UseOsThemes on the control to false in order to change the border colors.
Hi Mike,
Yes we are styling the control, but setting this property on the UltraTextEditor after the style has been applied works fine. After reading your comment about the DisplayStyle property i changed it to the various values only some of them seem to use the border color property, we are using the Default display style which i'm guessing is the standard value.
I tried setting the border color to red in a test project with UseOsThemes set false and DisplayStyle set to Default, but the border colour remained the default blue colour. Is there a property that the Standard/Default display style uses for its borders or is what i'm asking not possible?
Nathan2009 said:Yes we are styling the control
Do you mean to say that you are using Application Styling? If that's the case, then nothing you do on the control will affect the border colors if the Style is setting them.Unless you set UseAppStylist to false on the control or change the ResolutionOrder so that the control properties come first.
I assume that's not the problem, though, since you said that it works for some DisplayStyle settings.
I just tried placing a new UltraCombo on a form and default border color appears to be gray on my machine, not blue. Maybe this is related to a system setting. But perhaps your application style is using an Office2007 style?
Anyway, I then set the Appearance.BorderColor and indeed, this has no effect either at design-time or run-time.
Then I tried turning off themes by setting UseOsThemes to false.
Once again, the color is not honored. This is because the default borders are 3D and 2D borders are not controlled by the BorderColor property - since they are not a single color.
Instead, you have to use Appearance.BorderColor3DBase to provide a base color for the 3D borders.
Or, you could set the BorderStyle property to a flat border such as Solid, in which case the BorderColor would be honored.
Thanks for your help Mike, I now understand a bit more how the styling of the Infragistics controls works. As the only way to get this to work how i want is to not use os themes i have come up with another way. Using the paint event i am able to draw a border around the control whilst still keeping all my other colours and styling. I simply add and remove this event on the enter and leave event.
That sounds like a good solution. :)