Escaping Curly Braces in XAML
You may have already come across this dilemma - needing to put curly braces in the content of a XAML object - like a TextBlock. In XAML, { and } are used to denote markup extensions, so they can't be used without escaping them. Unfortunately, the escape mechanism is far from obvious.
In order to put curly braces in XAML, you must precede the literal with an empty set of braces - {}.
<!-- This works fine -->
<TextBlock Text="{}This is {my} text!" />
<!-- This will result in a compile error -->
<TextBlock Text="This is {my} text!" />
<TextBlock Text="{}This is {my} text!" />
<!-- This will result in a compile error -->
<TextBlock Text="This is {my} text!" />
MSDN has posted an article explaining this escape sequence in detail, so check there for more information.
Posted in XAML, All Tutorials by The Reddest |

October 28th, 2008 at 7:26 am
Not the most intuitive way to escape special characters…
Btw, shouldn’t it be “precede” instead of “proceed”
October 28th, 2008 at 8:16 am
Sanket, Thanks for the comment the grammar mishap has been fixed.