HTML to XAML Conversion, Display HTML in RichTextBox
Posted
by Erika
on Stack Overflow
See other posts from Stack Overflow
or by Erika
Published on 2010-04-01T14:11:30Z
Indexed on
2010/04/01
14:13 UTC
Read the original article
Hit count: 1785
Hi, unfortunately im REALLY stuck on this and was wondering in anyone knows how to work around this. I have some html text which i want displayed in a WPF RichTextBox.
At the moment, i'm using some helper APIs found http://blogs.msdn.com/wpfsdk/archive/2006/05/25/606317.aspx
to convert HTML to XAML.
So at the moment i have a xaml data string, but i cant see to find a way to display this correctly within the richtextbox :s
i have been trying the following:
string xamlData = HTMLConverter.HtmlToXamlConverter.ConvertHtmlToXaml(sBody,true);
FlowDocument result = XamlReader.Load(new System.Xml.XmlTextReader(new StringReader(xamlData))) as FlowDocument;
but this is crashing on the XamlReader.. Any other way will do, i just need to display an HTML string in this RichTextBox or something else!
Please Help!
© Stack Overflow or respective owner