- Label - lightweight plain text only
- RichText - as the name says it provides support for rich text.
Also allows html content to be imported (anchor tags <a> don't work)
- RichEditableText - provides the same rich text support as the RichText control.
Allows editing and anchor html tags work properly
As noted above, if you want to use anchor <a> tags, you must use a RichEditableText control. In this case you'd most likely want to also set the editable="false" property.
The anchor href property can be set to a relative path like
<a href="index.html">index</a>Or an absolute one like
<a href="http://google.com" target="_blank">google</a>Note that you can set the target property to control whether the link is opened in a new window or not.
If you want to listen for when the user clicks on an anchor it is possible, but involves a lot more work. Basically you import the html string into a TextFlow object. Then you iterate through all the child elements until you find the LinkElement (which represents the anchor tag), and then add a FlowElementMouseEvent.CLICK event listener.
Here is some sample code that I use to achieve this:
A simple control that I've created and use frequently is called HtmlLabel which extends the RichEditableText class to provide simple support for html text: