programmatic textblock entry with linebreaks

前端 未结 5 1975
挽巷
挽巷 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 12:55

    I have one component XAML

    
    

    Then I pass the string + Environment.NewLine;

    Example:

    textLog.Inlines.Add("Inicio do processamento " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + Environment.NewLine);
    textLog.Inlines.Add("-----------------------------------" + Environment.NewLine);
    

    The result is

    Inicio do processamento 19/08/2019 20:31:13
    -----------------------------------

提交回复
热议问题