eg:
string xaml =
@"<DataTemplate>
@"<TextBlock Text=""{{Binding Converter={{StaticResource templatesConverter}}, {0} }}""/>
@"</DataTemplate>";
MemoryStream stream = new MemoryStream(Encoding.ASCII.GetBytes(xaml));
ParserContext context = new ParserContext();
context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
DataTemplate datatemplate = (DataTemplate)XamlReader.Load(stream, context);
source
share