Search code examples
silverlightwindows-phone-7textblock

TextBlock how to Wrap with &#13 with .CS code ;


In the XAML, we can use the to wrap;

<TextBlock Height="219" HorizontalAlignment="Left" Margin="12,330,0,0" Name="textBlock1" 
          Text="TextBlock&#13;TextBlock" TextWrapping="NoWrap" VerticalAlignment="Top" Width="438" />

But i use the code like this:

 this.textBlock1.Text = "TextBlock&#13;TextBlock";

It doesn't wrap. I want to how to make it work in the .cs file.


Solution

  • this.textBlock1.Text = "TextBlock" + Environment.NewLine + "TextBlock";
    

    but "TextBlock&#13;TextBlock" is equal to "TextBlock\rTextBlock"