31 July 2008

How to dispaly HTML/rich text in Silverlight

Silverlight is intended for making applications way more that for making websites. If what you're making is more like a website (and what I'm working on definitely is), you're gonna want to put content, and if you're putting content, you're most probably putting text, and if you're putting a lot of text, you're gonna want to format it. And you've been formatting text in HTML since your early childhood, so your'e wondering how to insert this dear HTML of yours into a Silverlight application website.

You have three possibilities:

  1. Formatting text using the "Run" element.
  2. Using the HtmlTextBlock control written by Delay, which supports the tags: a, b, br, em, i, p, strong and u (but no CSS).
  3. HTML Overlay:
HTML overlay is explained here (and that's where the picture's from).

I'm trying HTML overlay today.