malte
malte

Reputation: 1181

HtmlAgilityPack - make HTML to XAML and bind to RichTextBox / TextBlock?

I'm trying to get simple html structures (few < p >, < em >, < i > and stuff) to work with TextBlock or RichTextBox XAML behaviour on WindowsPhone 8.

I found the HtmlAgilityPack and it seems to fit my needs. But I do not know how to get correctly formatted XAML code out of the HTML-String.

I've made the following attempt(s):

        HtmlDocument doc = new HtmlDocument();
        doc.LoadHtml(data.content);

        doc.OptionOutputAsXml = true;

        MemoryStream str = new MemoryStream();
        XmlWriter outStream = XmlWriter.Create(str);
        doc.Save(outStream);
//How to go on from here? (eg. making a string from the stream?)
//How to assign the XML-String to RichTextBlock?

Upvotes: 1

Views: 2539

Answers (1)

Stefan
Stefan

Reputation: 446

Check Social Media Dashboard for reference and this article by Tess Ferrandez.

http://blogs.msdn.com/b/tess/archive/2013/05/13/displaying-html-content-in-a-richtextblock.aspx

Upvotes: 2

Related Questions