Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "{" symbol in xaml string

Tags:

wpf

xaml

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.

like image 596
Seldon Avatar asked Feb 27 '23 16:02

Seldon


1 Answers

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>
like image 178
Christian Hayter Avatar answered Mar 06 '23 21:03

Christian Hayter