Click here to Skip to main content
Click here to Skip to main content

Tagged as

TIP: Change background of WPF Combobox

, 6 Nov 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
How to change the popup zone of a WPF Combobox programmatically without restyling
The Background property will just change the edit and drop arrow area of a WPF Combobox.
To change other colors like popup background and highlight color, you have to add some brushes to the resource dictionary, mapping to the system colors:
var combo = new Combobox(); 
combo.Background = Brushes.Yellow;
combo.Foreground = Brushes.Blue;
combo.Resources.Add(SystemColors.WindowBrushKey, Brushes.Yellow);
combo.Resources.Add(SystemColors.HighlightBrushKey, Brushes.Red);
This is equivalent to XAML code:
<Combobox Background="Yellow" Foreground="Blue">
      <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Yellow" />
      <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Red" />


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


About the Author

Jaime Olivares
Architect Freelance (
Peru Peru

Computer Electronics professional, Software Architect and senior Windows C++ and C# developer with experience in many other programming languages, platforms and application areas including communications, simulation systems, PACS/DICOM (radiology), GIS, 3D graphics and HTML5-based web applications.
Currently intensively working with Visual C# 2013 and TFS.
Can be reached at
Follow on   LinkedIn

Comments and Discussions

GeneralAnd how can i change only the edit part of the Combobox?I t... [modified] PinmemberMichael Golombiewski20-Jan-12 8:06 
And how can i change only the edit part of the Combobox?
I tried it with:
TextBox txtbx = (TextBox)comboBox1.Template.FindName("PART_EditableTextBox", comboBox1);
txtbx.Background = Brushes.Green;
But this doesn't work...

modified 19-Sep-14 1:47am.

GeneralRe: I solved it: TextBox txtbx = (TextBox)comboBox1.Template.Fin... PinmemberMichael Golombiewski22-Jan-12 11:41 
GeneralRe: I solved it:TextBox txtbx = (TextBox)comboBox1.Template.Fin... Pinmemberyalenap12-Feb-14 14:23 
GeneralReason for my vote of 1 Bad Pinmembergusbrasil10-Aug-10 7:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 6 Nov 2012
Article Copyright 2010 by Jaime Olivares
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid