换行符:
C#代码中:\r\n 或 \r 或 \n
XAML中:
 或 
注:\r 回车 (carriage return 缩写),\n 新行 (new line 缩写)。
行间距:
LineHeight属性
示例:
<TextBlock LineHeight="30" Text=" 第一行 
 第二行"/>
<TextBlock LineHeight="30" Text=" 第一行 
 第二行"/>
\r与\n的区别:
\r :到当前行的最左边。
\n:向下移动一行,并不移动左右。
Linux中:\n表示回车+换行;
Windows中:\r\n表示回车+换行。
Mac中:\r表示回车+换行。
WPF TextBlock 文本换行与行间距
最新推荐文章于 2024-03-21 23:12:55 发布