Hi all I started working on WPF richtextbox and it seems that it does not have features like auto detect url as in windows richtextbox. I need help in detecting hyperlink when we paste data in the richtextbox (wpf) .I already found some code blocks which works fine with typed words like I type www.google.com and when I press space or enter key after "m" in "www.google.com" it will traverse back and check for the previous space or enter and detect hyperlink and make it hyperlink.
I used following code to work with
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d3b82728-2b16-4b53-9550-e1cc5c39b169[
^]
It works fine most of the time but my problem is it goes to the link after traversing every character and when I have a lot of data it is not a better solution. Also it does not work with multiple paragraphs.
I tried another option to jump directly to the link word and detect it and make it hyperlink using following function
here match is a match collection which contains all the matches of urls
here I used following regex value
"(?<=\w{1})?(((ht|f)tp(s?))\://)?(www.[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*"
GetPositionAtOffset(match.index, LogicalDirection.Forward)
and get the point
But I get the following errors :
1) Hyperlink can not exists in the boundry of other ( can be caught in catch block so not a big problem)
Can anyone please help me in detecting urls when we paste text in it.
2 )Error code 0x80131623 ( can be found details when googled) and really challanging for me.
( I really apologize for grammatical or English mistakes)
Thanks