title: Load User Control dynamically and Default Namespace
body: <p>In Silverlight, when you want to create a control dynamically, you must add the namespaces like this (as in <a href="http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx</a>):</p>
  
  <pre><code>XNamespace xmlns = "http://schemas.microsoft.com/client/2007";
      XElement textBlock2 = new XElement(xmlns + "TextBlock",
          new XAttribute(XNamespace.Xmlns + "x", "http://schemas.microsoft.com/winfx/2006/xaml"),
          ...
          );
  </code></pre>
  
  <p>My problem is that I have a user control in its own namespace, so I must write something like</p>
  
  <pre><code>XNamespace myxmlns = "mynamespace";
  XElement myelem = new XElement(myxmlns + "MyCtrl", ...
  </code></pre>
  
  <p>I can then add aliased namespaces like that</p>
  
  <pre><code>new XAttribute(XNamespace.Xmlns + "x", "http://schemas.microsoft.com/winfx")
  </code></pre>
  
  <p>but I can't figure out how to add the default namespace. I either get a compile error or a run-time error ("AG E PARSER MISSING DEFAULT NAMESPACE"), whatever I try.</p>
  
  <p>I succeeded doing it with building a big string of what I need, but I would like to understand what I am missing.</p>
  
  <p>Any idea?</p>
  
  <p>Thanks.</p>