Programmatically set TextBlock Foreground Color

user818700 picture user818700 · Oct 4, 2012 · Viewed 114.5k times · Source

Is there a way to do this in Windows Phone 7?

I can reference the TextBlock in my C# Code, but I don't know exactly how to then set the foreground color of it.

myTextBlock.Foreground = 
//not a clue...

Thanks

Answer

Diana Mikhasyova picture Diana Mikhasyova · Oct 4, 2012
 textBlock.Foreground = new SolidColorBrush(Colors.White);