Enrichman
Enrichman

Reputation: 11337

Adding a new line in a TextBlock when needed

I'm reading JSON from a WebService and put my data in a list of textblocks (wrapped in grids). Sometimes the text is long and I would like that the textblock would add automatically a new line if needed (instead going to the right endlessly).

I've read somewhere that I should wrap the textblock in a Label (not recognized by VS2010?)..

I cannot put <\newline> or \n or anything because I don't know where or when.

Thanks.

Upvotes: 3

Views: 2433

Answers (3)

RMB
RMB

Reputation: 1

You can set TextWrapping property of Textblock to Wrap from Designer or from XAML....

Upvotes: 0

SENTHIL KUMAR
SENTHIL KUMAR

Reputation: 647

Add like this in your xaml

 <TextBlock TextWrapping="Wrap"/>

Upvotes: 2

Paul Diston
Paul Diston

Reputation: 3294

You could set the TextWrapping property to Wrap:-

http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.textwrapping.aspx

Upvotes: 3

Related Questions