title: XamlReader throws when loading generic.xaml to merge resource dictionaries
body: <p>Trying to load generic.xaml in code but it throws a XamlParseException. Code as follows:</p>
  
  <pre><code>Uri uri = new Uri("Themes/Generic.xaml", UriKind.Relative);
  StreamResourceInfo info = Application.GetResourceStream(uri);
  System.Windows.Markup.XamlReader reader = new System.Windows.Markup.XamlReader();
  
  ResourceDictionary resdict = (ResourceDictionary)reader.LoadAsync(info.Stream);
  
  this.Resources.MergedDictionaries.Add(resdict);
  </code></pre>
  
  <p>The idea is to merge a resource dictionary in a basepage. Then derived pages can use styles, colors, brushes, etc from their base class by using <code>{StaticResource DarkBrush}</code> for example.</p>
  
  <p>But the above code throws:</p>
  
  <p>'', hexadecimal value 0x0C, is an invalid character. Line 1, position 1.</p>
  
  <p>The generic.xaml file was created in VS2010 the standard way. Tried to set Build Action to Resource but that didn't work either...</p>
  
  <p>I got the <a href="http://msdn.microsoft.com/en-us/library/aa970494.aspx" rel="nofollow">code sample</a> from Microsoft. There it was used to load a page. Any help would be greatly appreciated. </p>