Using Runs in Silverlight Textblock with different font styles

We can format individual bits of text but keep them together in a single paragraph in a TextBlock using a Run object inside the TextBlock element.
Here’s an example that formats several words differently:

<TextBlock FontFamily=" Georgia" FontSize="20" > 
  This <Run FontStyle=" Italic" Foreground="YellowGreen">is</Run> a 
  <Run FontFamily=" Comic Sans MS" Foreground="Red" FontSize="40">test.</Run> 

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.