programmatic textblock entry with linebreaks

前端 未结 5 1962
挽巷
挽巷 2020-12-20 12:41

How do I programmatically add text with line breaks to a textblock?

If I insert text like this:

helpBlock.Text = \"Here is some text. 

        
5条回答
  •  死守一世寂寞
    2020-12-20 13:00

    You could just pass in newline \n instead of

    helpBlock.Text = "Here is some text. \n Here is \n some \n more.";
    

    Or in Xaml you would use the Hex value of newline

     
    

    Both results:

    enter image description here

提交回复
热议问题