How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight.
Edit: Here's the code I'm now using this for, based on the answer from Santiago below.
public DataTemplate Create(Type type)
{
return (DataTemplate)XamlReader.Load(
@"<DataTemplate
xmlns=""http://schemas.microsoft.com/client/2007"">
<" + type.Name + @" Text=""{Binding " + ShowColumn + @"}""/>
</DataTemplate>"
);
}
This works really nicely and allows me to change the binding on the fly.