Tuesday, June 7, 2011

How to escape invalid characters in XAML within a Markup Extension

Use %20 for a space and other XML Character Entities for the invalid characters, such as "{d:Design Data Source=/Sample%20Data/SampleData.xaml}" for the source path of "/Sample Data/SampleData.xaml".

In the case that you do NOT want to interpret "{" as the start of a Markup Extension, then put "{}" before it so it becomes "{}{". No need to do the same for the closing bracket "}".

No comments: