Silverlight: Setting ComboBox Background-Color Programmatically
This seems like it's far more difficult than it should be, but I'd like to set the background color of a dropdown co开发者_开发百科mbobox programmatically (ie. if the user selects one value, I'd like it to appear red, otherwise blue...)
What I've noticed is that if you just set the Background property to a SolidColorBrush, the only thing that seems to change is that slight-glow that the ComboBox has.
I know that the ComboBox is constructed of multiple objects, and that it takes more than just setting the BackgroundColor, but I'm just wondering if there's a simple way of doing this programatically, where the entire background changes colors, instead of the glow.
Unfortunately most of the colors involved are hardcoded into the combox style. Hence the only way you are going to achieve greater control over the color used is to copy out the entire ComboBox style and simplify the set of Rectangle
elements named Background....
.
精彩评论