How do you color a rectangle in C# that has been declared in XAML in WPF?
There is a rectangle control in XAML. In my C# code there are times in which it would be nice to fill the background color. How does one do this?
How do you color a rectangle in C# that has been declared in XAML in WPF?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


PJ MartinsRank #2,548 · 548 reputationPosted May 26, 2010, 6:14 PM EDT
rectangle.Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255)); // blue