This is a migrated thread and some comments may be shown as answers.

How to auto convert an url into a hyperlink when it is pasted?

1 Answer 39 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Yuxiao
Top achievements
Rank 1
Yuxiao asked on 28 Dec 2012, 10:14 AM
Hi.

When I tried to paste an url like "http://code.google.com/" into the RichTextEditBox, it doesn't convert to a hyperlink automatically.

Is it possible to convert it automatically without monitoring pasting events? If I had to monitor pasting event, can I have some examples? 

Thanks.


1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 28 Dec 2012, 01:39 PM
Hi Yuxiao,

With the Q2 2012 version of RadControls for Silverlight we released auto-hyperlinks feature in RadRichTextBox. Basically when you add an interval or a new line in the document, it matches the last word to a couple of regular expressions in order to determine if it is a valid hyperlink or email. In that case, it adds the respective for hyperlink functionality and UI representation.

This is similar to the way Microsoft Word works if you type or paste plain text which is a valid hyperlink. For example, if you paste the following text in both MS Word and RadRichTextBox:
http://code.google.com/ http://code.google.com/ http://code.google.com/

none of the lines will be converted to hyperlinks at first. If you then add an interval right after one of the occurrences of  "http://code.google.com/", only this occurrence will be converted to a hyperlink.

You can verify that behavior in our online demo.

 
Regards,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Yuxiao
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or