Seldon
Seldon

Reputation: 1425

How to use "{" symbol in xaml string

How can I use { symbol in xaml string? E.g.:

<TextBlock Text="{0}"/>

I can do it starting string with a space symbol:

<TextBlock Text=" {0}"/>

but I'm looking for a better solution.

Upvotes: 4

Views: 696

Answers (1)

Christian Hayter
Christian Hayter

Reputation: 31071

Like this:

<TextBlock Text="{}{0}"/>

The {} at the start tells the parser to not look for markup extensions.

Alternatively, you can specify the data without using an attribute:

<TextBlock>{0}</TextBlock>

Upvotes: 8

Related Questions