Home.NETEscape the Curly Braces in XAML

Escape the Curly Braces in XAML

If you want to set the value of a property to a string that begins with the open curly brace in XAML , you may want to escape  it in order to avoid it being treated as markup extension.

How to escape the Curly Braces in XAML  ?

You can do this by preceding the string with the empty pair of curly braces. Below is a sample code snippet on how to do it.

<Button Content="{}{This is a developerpublish blog}">
</Button>

image

Alternatively , you can use the property element syntax without escaping the curly braces as shown below.

<Button>
        <Button.Content>
          {This is a developerpublishblog}
        </Button.Content>
</Button>

Leave a Reply

You May Also Like

In this post, you’ll learn about the error message “WorkbookNotSupported – The file you selected cannot be opened because it...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SpecifiedRangeNotFound – The requested range does not exist in the sheet.”...
  • .NET
  • December 17, 2022
In this post, you’ll learn about the error message “SheetRangeMismatch – The sheet provided as the sheet argument is not...
  • .NET
  • December 17, 2022