Preserve space and new lines in Silverlight TextBlock

Developers can add the xml: space=”preserve” attribute to your TextBlock element, which tells the XAML parser to honor every space, tab, and hard return between the opening > character (which ends the start tag) and the closing < (which begins the end tag).

<TextBlock xml: space="preserve" 
>This is line 1. 
    This is an indented line 2. </TextBlock>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.