Display label text with line breaks in c#

后端 未结 8 680
面向向阳花
面向向阳花 2020-12-05 09:28

Is it possible to display the label text with line breaks exactly as per the image

\"enter

8条回答
  •  不知归路
    2020-12-05 10:05

    I had to replace new lines with br

    string newString = oldString.Replace("\n", "
    ");

    or if you use xml

    
    

    Then in code behind

    public string ShowLineBreaks(object text)
    {
        return (text.ToString().Replace("\n", "
    ")); }

提交回复
热议问题