<p>Suppose I have some XAML like this:</p>

<pre><code>&lt;Window.Resources&gt;
  &lt;v:MyClass x:Key="whatever" Text="foo\nbar" /&gt;
&lt;/Window.Resources&gt;
</code></pre>

<p>Obviously I want a newline character in the MyClass.Text property, but the XAML parser constructs the object with the literal string "foo\nbar".</p>

<p>Is there (a) a way to convince the parser to translate escape sequences, or (b) a .NET method to interpret a string in the way that the C# compiler would?</p>

<p>I realize that I can go in there looking for <code>\n</code> sequences, but it would be nicer to have a generic way to do this.</p>

Off the top of my head, try;
A custom binding expression perhaps?
```
<v:MyClass x:Key="whatever" Text="{MyBinder foo\nbar}"/>
```
Use a string static resource?
Make Text the default property of your control and;
```
```
<v:MyClass x:Key="whatever">
foo
bar
</v:MyClass>
```
```