Export (0) Print
Expand All

{} Escape Sequence / Markup Extension

Provides the XAML escape sequence for attribute values, allowing the subsequent values in the attribute to be interpreted as a literal.

<object ... property="{}literalValue" .../>

<object>
  <object.property>
    {}literalValue
  </object.property>
</object>

literalValue

The literal string being escaped.

The {} escape sequence is used to escape the { and } as used for markup extensions in attribute syntax. The escape sequence itself is not strictly speaking a markup extension and is not backed by a class. All other markup extensions in XAML use the { and } characters as recognized by XAML reader implementations for escaping the handling of attribute values to be other than literals or handler references. Only the special case of the two curly braces adjacent will be treated as the escape sequence. For more information, see Markup Extensions and XAML.

This escape sequence is useful when you want to set the literal character { as the first character of a value.

Note that a quotation mark character (") cannot be escaped in this way. If you need to set a quotation mark character as a property value for a noncontent property, use property element syntax and place the quotation mark as a string inside the property element, or use an XML character entity. For a content property, the quotation mark can be the entire content.

Community Additions

ADD
Show:
© 2014 Microsoft