TRS
TRS

Reputation: 2097

Show a label content in double quotes

I want to show myLabel in double quotes like "MyTestString".Iam using following content string format.Please correct me ,its not showing in quotes.

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

Upvotes: 1

Views: 1809

Answers (2)

Loetn
Loetn

Reputation: 4040

You have to remove the slashes:

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

But why don't you add your quotes when you get MyLabel from your model?

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

EDIT

Even with slashes it shows double quotes.

Upvotes: 3

Dhaval Patel
Dhaval Patel

Reputation: 7601

You shoule use

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

Upvotes: 1

Related Questions