Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Parse hyperlinks

 
 
Old 11-26-2006   #1 (permalink)
Jan Kucera


 
 

Parse hyperlinks

Hi,
I would like to render a text on a form, but make the http links active. I
know how to find them with Regex, but I have no idea how to make them
clickable...with all text flow capabilities... I think this behaviour is
requested quite often, any hints?
It would be nice if it could be done generally (handle click on any custom
"hot" keywords...) Thanks for ideas.

Jan


My System SpecsSystem Spec
Old 11-27-2006   #2 (permalink)
Douglas Stockwell


 
 

Re: Parse hyperlinks

Given your text, you can break it up and build up the following structure:

<TextBlock>
<Run Text="aaa" />
<Hyperlink><Run Text="bbb" /></Hyperlink>
</TextBlock>

TextBlock tb = new TextBlock();
tb.Inlines.Add(new Run("aaa"));
tb.Inlines.Add(new Hyperlink(new Run("bbb"));

See also the NavigateUri property and Click event of the hyperlink.

"Jan Kucera" <kucera@lupacovka.cz> wrote in message
news:B5E8258A-EAA0-4401-9263-7FBF9256CDEC@microsoft.com...
> Hi,
> I would like to render a text on a form, but make the http links active. I
> know how to find them with Regex, but I have no idea how to make them
> clickable...with all text flow capabilities... I think this behaviour is
> requested quite often, any hints?
> It would be nice if it could be done generally (handle click on any
> custom "hot" keywords...) Thanks for ideas.
>
> Jan


My System SpecsSystem Spec
Old 11-27-2006   #3 (permalink)
Jan Kucera


 
 

Re: Parse hyperlinks

Well that looks great. Now.. should I take the string, split it to
text/hyperlinks and then add these to the TextBlock, or is there any elegant
way to do this on TextBlock text at once?
Thanks,
Jan

"Douglas Stockwell" <doug@remove.11011.net> wrote in message
news71E0B71-6E31-4D50-A465-4A9A1CEFA8CE@microsoft.com...
> Given your text, you can break it up and build up the following structure:
>
> <TextBlock>
> <Run Text="aaa" />
> <Hyperlink><Run Text="bbb" /></Hyperlink>
> </TextBlock>
>
> TextBlock tb = new TextBlock();
> tb.Inlines.Add(new Run("aaa"));
> tb.Inlines.Add(new Hyperlink(new Run("bbb"));
>
> See also the NavigateUri property and Click event of the hyperlink.
>
> "Jan Kucera" <kucera@lupacovka.cz> wrote in message
> news:B5E8258A-EAA0-4401-9263-7FBF9256CDEC@microsoft.com...
>> Hi,
>> I would like to render a text on a form, but make the http links active.
>> I know how to find them with Regex, but I have no idea how to make them
>> clickable...with all text flow capabilities... I think this behaviour is
>> requested quite often, any hints?
>> It would be nice if it could be done generally (handle click on any
>> custom "hot" keywords...) Thanks for ideas.
>>
>> Jan

>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
parse files VB Script
MSXML 4.0 SP2 Parse and SDK Vista performance & maintenance
Can Powershell parse email? PowerShell
Parse XML files from Powershell? PowerShell
Using Parse-TextObject PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46