X
X
Xveeder2018-07-29 12:56:27
WPF
Xveeder, 2018-07-29 12:56:27

How to render html code from string in WPF application?

Good afternoon friends.
The task is as follows, the client receives an HTML code, which is processed and packed into a string. Further, this code needs to be fully rendered and displayed, but the problem is that this code should not be read from a file, but from a string.
How to do it?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2018-07-29
@Gorily

Did I understand you correctly: the program requests a certain page (request), the results are returned as an HTML string. Your task is to display elements nicely in a WPF application.
Options:

  • Display the contents of a string in a WebBrowser:
    var browser = new System.Windows.Controls.WebBrowser();
    browser.NavigateToString(string strHtml);

  • Use a converter to FLOWDOCUMENT, details here: blogs.spensen.com/?p=672
  • You can also use any HTML parser, such as the Html Agility Pack , and manually go through the code elements, creating interface elements along the way:
    var doc = new HtmlDocument();
    doc.LoadHtml(html);

L
LiptonOlolo, 2018-07-30
@LiptonOlolo

If I correctly understood the essence of the question, then: HtmlRenderer.WPF

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question