Escaping curly braces in XAML code

Sometimes you want your user interface text contains a curly brace “{“. Unfortunately, the xaml parser will consider it as markup extension and will refuse to compile. For example, the below code will not compile and will give an error: The given key was not present in the dictionary.

TextBlock Text="{Username:"

In order to escape the curly brace, you need to add “{}” before your text brace as shown below:


TextBlock Text="{}{Username:"

Advertisements

The extension name ‘enableWebScript’ is not registered error

While deploying a project I am working on that contain an AJAX enabled WCF service, I got the following error:

Invalid element in configuration. The extension name ‘enableWebScript’ is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.

After hours of searching, it turned out to be that when you run the wcf uninstall command as shown below, it removes with the configurations from the machine.config.

servicemodelreg.exe -u

I found someone who suggested to add the xml tags manually to the machine.config. Although it worked, I got other errors. At the end, I reinstalled .Net FrameWork 3.5 SP1, in order to resolve that issue.