C# – HTML Formatting in RichTextBox

cformattinghtmlrichtextboxxml

I've been working with HTML strings obtained from an XML file. I'm trying to figure out a way to display these strings in a richtextbox with formatting.
So
e.g.

 <p>This is a <strong>HTML</strong> string from the <em>XML</em> file</p>

or

 <p>This is our <span style="text-decoration: underline;">response</span></p>

Should be displayed in the richtextbox like so:

This is a HTML string from the XML file

This is our response <<– this should be underlined

I'm not too sure how to go about with this. And I'm not too sure as to how the WebBrowser class would work here as the HTML strings are individual, and won't form a complete HTML file.

Additionally, I need a way to reverse the formatting (HTML encode) once any changes are made in the richtextbox as they'll be written back to the XML file.

Is there a way for me to achieve this? I really could use the help. I'm stumped.

EDIT:

If it helps, here's the part of the XML where I get my strings from (something similar to this).

<Field id="13598" type="1">&lt;p&gt;&lt;strong&gt;This &lt;/strong&gt;is our &lt;em&gt;response&lt;/em&gt;&lt;/p&gt;</Field>

I'm basically trying to allow users to edit and save the string in Field.

EDIT 2:

I've managed to use a WebBrowser control to sort of fulfill my requirements, but I'm facing a new problem. Have a look here:
Editing HTML with a WYSIWYG Editor
Any help would be greatly appreciated!

Best Answer

I've solved it using a WYSIWYG HTML editor. However, I'm facing a new problem, if anyone could help, that'd be great!

Here's my new question: Editing HTML with a WYSIWYG Editor