RichTextBlock Extensions

Mar 26, 2014 at 12:03 PM
Hi - I'm trying to create anchor links within a large amount of text held in RichTextBlock, but can't work out how to set and search for the links - could you provide a quick example or how this can be done. I can;t find anything on Stack Overflow about this.

Thanks, Michael
Coordinator
Mar 26, 2014 at 7:30 PM
Not sure what you mean. Are you asking about something in the toolkit or something you want to do? If the former - can you elaborate? If the latter - can you elaborate on Stack Overflow?
Coordinator
Mar 26, 2014 at 7:40 PM
Would something like this work for you?

http://stackoverflow.com/questions/10516140/how-to-replace-link-to-hyperlink-in-richtextbox-windows-phone

I believe I have ported that into the toolkit:

https://winrtxamltoolkit.codeplex.com/SourceControl/latest#WinRTXamlToolkit/Controls/Extensions/RichTextBlockExtensions.cs

You use that by setting RichTextBlockExtensions.LinkedHtmlFragment to a html fragment and it formats the anchor links. It's fairly limited in what it supports though.
Mar 26, 2014 at 8:09 PM
That's perfect Filip! I hadn't seen the SetLinkedHtmlFragmentString method - that will fit my requirements exactly.

Thanks for your response, Michael