Joel
Joel

Reputation: 309

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.

Upvotes: 1

Views: 321

Answers (1)

Bala R
Bala R

Reputation: 108967

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

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

Upvotes: 4

Related Questions