This project is read-only.
HTMLTextBox is a subclass of the RichTextBox with an additional Html property. Html is a dependency property that autoparse html to xaml document and represent it within a control. You can easily use it with bindings.

<msp:HTMLTextBox Html="&lt;b style='font-size:xx-large;color:gold' &gt;kjjhk&lt;/b&gt;&lt;a href = 'http://example.com'&gt;link&lt;/a&gt;&lt;ol&gt;&lt;li&gt;567&lt;/li&gt;&lt;li&gt;890" />
or
<msp:HTMLTextBox>&lt;b style='font-size:xx-large;color:gold' &gt;kjjhk&lt;/b&gt;&lt;a href = 'http://example.com'&gt;link&lt;/a&gt;&lt;ol&gt;&lt;li&gt;567&lt;/li&gt;&lt;li&gt;890</msp:HTMLTextBox>

HTMLTextBox htb = new HTMLTextBox();
htb.Html = @"<b>Bold</b><i>italic</i>and<u>underline</u>text";

Links handling

<msp:HTMLTextBox NavigaionPolitic="Manual" HyperlinkClick="HTMLTextBox_HyperlinkClick"

HTMLTextBoxHyperlynkNavigaionPolitic.Automatic
Automated url resolving. Open IE when http uri.
HyperlinkClick event raises anyway.
HTMLTextBoxHyperlynkNavigaionPolitic.Manual
Manual uri resolving you need to subscribe to HyperlinkClick event

Image Click

public event EventHandler<ImageClickEventArgs> ImageClick;
Sender is Image object.
ImageClickEventArgs returns ImageSource object.


*supports
<b>, <i>, <u>, <br>, <img>, <a>, <ol>, <ul>, <span>, <p> and some css

Warning

  • this control designed for representing simple html from rss, tweets and so on
  • this control based on RichTextBox that has max render size (about 2000 pixels height). If you need to show large html document, you have to divide it into 2 different HTMLTextBox or use HTMLViewer instead.

Last edited Jul 27, 2012 at 5:30 AM by ad1Dima, version 9

Comments

ad1Dima Jul 25, 2012 at 12:51 PM 
Sorry, for late response (I don't get any message about this comment) Just try in sample app Foreground property takes affect on links too. In future for any help you better go to Discussion section.