2014-04-18 135 views
1

我想用双引号将MyLabel显示为“MyTestString”.Iam使用以下内容字符串格式。请纠正我,它不显示在引号中。用双引号显示标签内容

<Label ContentStringFormat="\&quot;{0}\&quot;" Content="{Binding MyLabel}"  
       Foreground="WhiteSmoke" FontWeight="Medium" FontSize="20"/> 

回答

2

您必须删除斜线:​​

<Label ContentStringFormat="&quot;{0}&quot;" Content="{Binding MyLabel}"  
       Foreground="WhiteSmoke" FontWeight="Medium" FontSize="20"/> 

但是你为什么不添加引号,当你从你的模型MyLabel

private string myLabel; 
public string MyLabel 
{ 
    get 
    { 
     return "\"" + this.myLabel + "\""; 
    } 
} 

编辑

即使有斜杠它显示了双引号。

+0

谢谢,是的,它是双向ways.I意识到一些全局设置风格被重写标签默认样式所以它没有显示。 – TRS

0

您shoule使用

<TextBlock Text='You shouldn&apos;t choose &quot;Copy if New&quot;:'/>