BSA – Styling Native Controls

It is two controls with an identical border on the picture above. The button display the border correctly, while the ComboBox do not display the border at all. It does have a BorderBrush that I set, but it has no effect. This is quite common with build in native controls – it might be a trick to this – I don’t know. This is sadly a repeatetive challenge for styling Windows GUI, so what I will do is to create my own ComboBox that I can control 100% – I simply need controls I can trust because I will re-use them in the SDK. So, it is often less effort to simply create a new one than fighting Windows GUI limitations.

In this case I want to control colors for Normal, Hover and Selected on Background, Foreground, Border as well as all details on the drop down part as well. I need full control and so do you. In old Windows you could use the control and take over painting – I am a bit on thin ice on that on WPF, so lets see. If I can control the ComboBox I will use it as is, but it is more than just controlling as we would like to add images and details on the selection list etc.

Or a workaround can be to just overlay a transparent rectangle with rounded corners like above to get around this specific issue. What you see is the Hovering effect of my ButtonStyle=Border Button. I code that into all controls so you can visualize selection or hovering with a thick border – a “Standard” control will change background. These effects are handy in creating a modern, custom styled HMI.

Leave a Reply