Search code examples
wpfline-breaks

LineBreak in a Run


How to have a LineBreak in a run?
In mean IN
The content coming in dynamically has line breaks
I know a LineBreak between runs works
<LineBreak/> in a run throws a syntax error
Below are the options I have tried - none of them work

<TextBlock>
    <Run>Run1</Run>
    <LineBreak/>  
    <Run>Run2a&#10;Run2b\r\nRun2c/r/nRun2d&#xA;Run2e&lt;LineBreak/&gt;Run2gRun2e</Run>          
</TextBlock>

Solution

  • Try &#x0a; , using inside of Text attribute:

    <Run Text="Text&#x0a;Next Line" />