WPF Textblock, linebreak in Text attribute WPF Textblock, linebreak in Text attribute wpf wpf

WPF Textblock, linebreak in Text attribute


Try this:

<TextBlock>    line1    <LineBreak />    line2</TextBlock>


I know this is ressurecting an old question, but I had the same problem. The solution for me was to use HTML encoded line feeds (&#10;).

Line1&#10;Line2

Looks like

Line1
Line2

For more of the HTML encoded characters check out w3schools


The easiest way is

<TextBlock> blabla <LineBreak /> coucou <LineBreak /> coucou 2 </TextBlock>

So you just write XAML code, and the <LineBreak /> has exactly the same meaning the
in HTML or the "\n" in C#.