Friday, November 2, 2007

Quick Silverlight Hyper Links

this for the most part I don't do silverlight such that I need a lot of links so this never occured to me before but here is a nifty little trick I thought...

So say I put an image tag in my xaml that I want to link to something. I can put the url in the 'tag' property and then ad a mouseleftbuttondown to this little function:

function LaunchItem( sender, args )
{
window.open(sender.Tag, '_blank');
}

and your good.

So the xaml ends up looking like this:

<img height="30" src="" name="RSS" opacity=".4" source="img/rss.png" left="110" top="40" cursor="Hand" zindex="1" mouseleftbuttondown="LaunchItem" tag="http://hackingsilverlight.blogspot.com/feeds/posts/default" //&rt;

If you want some cool animation or roll over then you have to add that your self.

No comments:

Post a Comment