WPF - setting background color of control programmatically

Searching for a way to set the background color of a WPF control programmatically seemed like more of an adventure then it should have been; there are sure a lot of complicated ways to set a background color.   Reluctant to believe that it was this complicated I kept searching until I found it.

txtStatus.Foreground = new SolidColorBrush(Colors.White);
txtStatus.Background = new SolidColorBrush(Colors.Red);


Tags: ,
Categories: WPF


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know