C#、WPF的XAML中特殊字符的转义代码

发布时间 2023-08-31 18:05:24作者: 潇潇烟雨

xmal文件中,写入对应转义符可以实现对应功能

字符
转义字符
&
&
>
>
<
<
"
"
'
{
{}{
回车
&#x000D;或者&#13;
换行
&#x000A;或者&#10;
Tab
&#x0009;或者&#9;
空格
&#x0020;或者&#32;

 

如:

<Border CornerRadius="8" Background="{DynamicResource RechargeEnterSelectBackBrush}" Height="120">
  <TextBlock Text="上下键切换券&#10;F1选中或取消用券" TextWrapping="Wrap" Foreground="White" FontSize="28" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20"/>
</Border>