Highlighting Links in a Textbox
I am fetching Twitter updates, and displaying them on a Panoramic page. On开发者_运维知识库 one individual panoramic control, I have a list box containing textboxes, which displays all of the Twitter status.
I would like to highlight a link if it is in a Twitter status.
How can I highlight an individual piece of text in a Textbox?
You'll need to create your own control which parses the tweet and converts it into something that you can display.
In a similar scenario I parsed the text and added each word that wasn't a link to a WrapPanel
as a TextBlock
and the ones that were as HyperlinkButton
s.
Edit:
Note: the WrapPanel is part of the Silverlight Toolkit.
I haven't tried it out myself but version 7.1 of the developer tools contains the RichTextBox
class that allows all sorts of formatted text display options, including hyperlinks.
Of course, any app that uses this will have to wait until fall when MS releases the Mango update before it can be distributed to users.
精彩评论