Change color of text in silverlight

In Silverlight, text is colored black by default. You can change the color of your text using the Foreground property. You can set it using a color name in XAML:

<TextBlock x: Name="txt" Text="Hello World" Foreground="Red"></TextBlock>

or in code

txt.Foreground = new SolidColorBrush(Colors.Red);

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.