tags:

views:

35

answers:

2

So here I am trapped in a nightmare of trying to make text wrap in silverlight. I have text intermixed with links. LIke this:

text text text link text text text link

It needs to wrap. I've tried things like textwrapping and wrap panels but I just can't get it right.

Any ideas on how to do this? My only idea is to split up the text of the textblock into seperate textblocks for each word and put it into a wrap panel. Not easy!

I read about runs and textblocks. Do runs have an onclick event? What can I do to make the text wrap?

A: 

You can use something like HtmlTextBlock.

See the article here: http://blogs.msdn.com/delay/archive/2007/09/24/bringing-more-html-to-silverlight-htmltextblock-improvements.aspx

Hope it helps

Brandon Truong
+1  A: 

"Runs" are a part of a set of objects provided by the System.Windows.Documents namespace that comes with Silverlight 4 and are displayed in a RichTextBox control. These objects do not raised events themselves.

However if you are able to use SL4 then the RichTextBox may well be the right control for you. It has a Hyperlink element that, whilst not raising events, does carry Command and CommandParameter properties for MVVM stylie interaction (or you can simply assign a URI).

AnthonyWJones