Silverlight 3 Navigation: My HyperlinkButtons don’t work!
Posted on January 17, 2010
The navigation framework of Silverlight 3 is great. The URI mapping and browser history support add a lot of value.
When upgrading a Silverlight 2 site to use Silverlight 3 with navigation, I was surprised to see that all of my HyperlinkButtons that referenced external URLs were failing!
It turns out that once your HyperlinkButton is inside of a navigation frame (which it will be once you add navigation support to your application), you need to set the TargetName property of the button. To preserve the Silverlight 2 behavior where the referenced URI loads in the same browser window, use “_self” as the TargetName.
You can also use “_blank” to open up the page in a new browser window.
When using a HyperlinkButton to navigate to a Silverlight page internal to your application, TargetName should reference the name of the navigation frame.
HyperlinkButtons fixed!
Got something to say?