title: Why does XamlWriter adds a {} to some attributes?
body: <p>I'm saving a resource dictionary to <code>Xaml</code> using <code>XamlWriter</code> and I noticed that for <code>string</code> properties with just <code>{p}</code>, the <code>XamlWriter</code> adds a <code>{}</code> before the text (resulting in <code>{}{p}</code>).</p>
  <p>Why does that happen? Is there any way to prevent this?
  Or at least to remove it safely when read back using a standard <code>XDocument.Parse()</code>?</p>
  <p>Here's how I'm saving it:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Example 
  {
      public string Property { get; set; }
  }
  
  var resource = new ResourceDictionary();
  resource.Add(&quot;Example&quot;, new Example { Property = &quot;{p}&quot; });
  
  var settings = new XmlWriterSettings
  {
      Indent = true,
      IndentChars = &quot;\t&quot;,
      OmitXmlDeclaration = true,
      CheckCharacters = true,
      CloseOutput = true,
      ConformanceLevel = ConformanceLevel.Fragment,
      Encoding = Encoding.UTF8,
  };
  
  using (var fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None))
  using (var writer = XmlWriter.Create(fileStream, settings))
      XamlWriter.Save(resource, writer);
  
  </code></pre>
  <h2>Edit</h2>
  <p>The <code>{}</code> is a scape sequence that is added when the text contains an open and close brackets like <code>{...}</code>.</p>
  <p><a href="https://docs.microsoft.com/en-us/dotnet/desktop/xaml-services/escape-sequence-markup-extension" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/desktop/xaml-services/escape-sequence-markup-extension</a></p>
  <p>Now, the only question remaining is how can I safely remove these scape sequences from my text. Can I simply do a replace or trim, or is there a method for that already?</p>