wpf newline

method 1:
<TextBlock Text="First line
Second line"/> 
Add:
in the middle of the text. This method is very useful and can also be used on ToolTip:
<ToolTip Width="200" Content="'First row' 
                   'Second row' 
                   'The first row Three lines'"/> Method 2: <TextBlock xml:space="preserve"> first row second line </TextBlock> Preserve can preserve spaces in xaml Method 3: <TextBlock Text="{Binding StringFormat='the first line {0} the second line {0} the third line', Source={x:Static s:Environment.NewLine}}" />

<sys:String x:Key="NewUpdateWillShow" xml:space="preserve">First line Second line </sys:String>

Newline is

Must add xml:space="preserve", otherwise the newline character is invalid.

 

<sys:String x:Key="txtEditorTipSrc" xml:space="preserve">First line Second line</sys:String>

 

Official document reference: http://msdn.microsoft.com/zh-CN/library/cc189036(VS.95).aspx#whitespace

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325219065&siteId=291194637