用双引号显示标签内容
本文关键字:标签 显示 | 更新日期: 2023-09-27 17:59:02
我想用双引号显示myLabel,比如"MyTestString"。我使用以下内容字符串格式。请纠正我,它没有用引号显示。
<Label ContentStringFormat="'"{0}'"" Content="{Binding MyLabel}"
Foreground="WhiteSmoke" FontWeight="Medium" FontSize="20"/>
您必须删除斜杠:
<Label ContentStringFormat=""{0}"" Content="{Binding MyLabel}"
Foreground="WhiteSmoke" FontWeight="Medium" FontSize="20"/>
但是,当您从模型中获得MyLabel
时,为什么不添加报价呢?
private string myLabel;
public string MyLabel
{
get
{
return "'"" + this.myLabel + "'"";
}
}
编辑
即使有斜线,它也显示双引号。
您应该使用
<TextBlock Text='You shouldn't choose "Copy if New":'/>