LineBreak and Run in Silverlight/WPF TextBlock

<Grid>
  <TextBlock>
    Hello World. <LineBreak />This
    is the second line. The breaking of
    the lines in the XAML are
    <Run Foreground="Red">not significant</Run>.
  </TextBlock>
</Grid>

A LineBreak indicates where line breaks are going to occur without regard to the TextWrapping property. A Run is used to wrap some piece of text that needs to be formatted differently than other parts of the TextBlock. The Run supports the basic properties that a TextBlock allows but only applies them to the text inside the Run element as shown above.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.