<p>How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight.</p>

<p>Edit: Here's the code I'm now using this for, based on the answer from Santiago below.</p>

<pre><code>public DataTemplate Create(Type type)
{
  return (DataTemplate)XamlReader.Load(
          @"&lt;DataTemplate
            xmlns=""http://schemas.microsoft.com/client/2007""&gt;
            &lt;" + type.Name + @" Text=""{Binding " + ShowColumn + @"}""/&gt;
            &lt;/DataTemplate&gt;"
   );
}
</code></pre>

<p>This works really nicely and allows me to change the binding on the fly. </p>

citation from MSDN
:
The XAML usage that defines the content for creating a data template is not exposed as a settable property. It is special behavior built into the XAML processing of a DataTemplate object element.