HTML to XAML Conversion, Display HTML in RichTextBox
- by Erika
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!