Set background color of WPF Textbox in C# code
textBox1.Background = Brushes.Blue; textBox1.Foreground = Brushes.Yellow; WPF Foreground and Background is of type System.Windows.Media.Brush. You can set another color like this: using System.Windows.Media; textBox1.Background = Brushes.White; textBox1.Background = new SolidColorBrush(Colors.White); textBox1.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0, 0)); textBox1.Background = System.Windows.SystemColors.MenuHighlightBrush;