Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having trouble styling a ComboBox. I have given a link to a screenshot that shows a ComboBox next to some TextBlock controls. When the ComboBox is not selected, I want it to look like the TextBlock controls, but I can't seem to find the property to get rid of the default grey background.

Any help would be most appreciated.

Kind wishes - Patrick

Capture.JPG - Google Drive[^]

Note: The link doesn't appear to work unless you copy and paste it into the browser address bar.

What I have tried:

I have tried the Background property and have looked through all the properties on MSDN (though I haven't yet worked my way up the class hierarchy to see if I can see the property causing the problem).
Posted
Updated 10-Nov-19 9:45am
v4
Comments
[no name] 18-Nov-16 10:16am    
https://msdn.microsoft.com/en-us/library/ms752094(v=vs.110).aspx
Patrick Skelton 18-Nov-16 10:54am    
Thank you for that link. Jeez... could it be any more complicated? That seems like a monstrous amount of work to change a single property of the standard ComboBox. Is there any way to get a copy of the in-built control, so I could just change the bit I want?
J. Calhoun 18-Nov-16 13:44pm    
I was not able to see the link here at my location due to restrictions; however, from what I understand is when you are not selecting the combobox, you would like the style to look more like a textblock. The link that NotPolitcallyCorrect posted is the documentation on how a combobox is created from scratch; however you can change it without that much work. I would however create a control template in a resource dictionary that targets combobox. Then I would add a trigger on the control template that fires when the combobox does not have focus that changes the style of the template to look like a textblock.

>This is a less intense link of a combobox control template style.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/af2b067b-6416-4381-a7c1-63cf6f74b3aa/combobox-custom-controltemplate?forum=wpf
Patrick Skelton 21-Nov-16 6:00am    
Thank you for that.

1 solution

Right click on the combobox go to properties and change the BackColor property to whichever color you want.
 
Share this answer
 
Comments
Patrick Skelton 22-Nov-16 9:17am    
I guess I'm being thick here, but I can't seem to find any setting that changes the default grey colour.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900