textBox1.Background = Brushes.Blue;
textBox1.Foreground = Brushes.Yellow;
WPF前景和背景的类型为System.Windows.Media.Brush
.您可以像这样设置另一种 colored颜色 :
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;