1

I have a html string :

<html>
  <body>
    <!-- DTD html gebruiken -->
                    Een host heeft IP adres <span class="ipAdres"><field ref="IpAdres" class="css-class"></field></span>
                    en netmask <span class="ipAdres"><questionParameter ref="NetMask"></questionParameter></span><br></br>
                    Geeft het adres van het <b>netwerk adres</b>:
                    <field ref="NetwerkAdres" CssClass=""><!-- Voor dit veld wordt de default feedback voor een correct antwoord gebruikt--></field><br></br>
                    Geef een ander <b>hostadres</b> binnen hetzelfde netwerk:
                    <field ref="AndereHost" CssClass=""></field><br></br><!-- Voor dit veld worden beide default feedbacks gebruikt-->
                    Geef het broadcast adres binnen dit netwerk:
                    <field ref="BroadcastAdres" CssClass=""></field></body>
</html>

so i want that wpf shows this in a window, but without the tags.. It has to render, but i don't know how i have to do that. Someone who can help me out?

4 Answers 4

2

You can use the following code to achieve this:

System.Windows.Controls.WebBrowser browser = new System.Windows.Controls.WebBrowser();
browser.NavigateToString(string strHtml);
Sign up to request clarification or add additional context in comments.

Comments

1

Check out this HTML to FlowDocument Converter as the article says "it's not fool proof" though it has worked well enough for me. It allows you to bind directly to a property containing the HTML string and will produce a flow document which can be added to your window.

1 Comment

I know this is years back but link is broken now.
0

either use WebBrowser control, which would render the html completely, or use RegularExpression to remove everything within < & >

2 Comments

I use the second option now.. but it's not very nice.. So how do i have to bind the WebBrowser to my viewmodel and so to a string property?
0

Have a look at this question it show how to manipulate the html in the webbrowser control. Binding is hardly possible unless you wrap the logic from the post into your viewmodel.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.