WPF Textblock, linebreak in Text attribute

后端 未结 15 1207
南方客
南方客 2021-02-03 16:37

Is there a way to have \\n make a line break in a TextBlock?


Or is there a

相关标签:
15条回答
  • 2021-02-03 17:16

    If you are binding TextBlock's Text, none of the other answers work. Simply add '\n' to the binding text to where you want to break.

    0 讨论(0)
  • 2021-02-03 17:18

    Try this:

    <TextBlock>
        line1
        <LineBreak />
        line2
    </TextBlock>
    
    0 讨论(0)
  • 2021-02-03 17:20
      <HyperlinkButton 
            Content="Apply and restart this pplication!&#10;&#13;Note that modifying these settings requires the application to be restarted."   />
    

    CRLF simple way = !&#10;&#13;

    !&#10;&#13; - Work on all wpf, xaml, silverlight controls like TextBlock, HyperlinkText and more

    0 讨论(0)
提交回复
热议问题