Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Hyperlink button does not work when used in navigation page
2 replies. Latest Post by richardfen on November 7, 2009.
(0)
richardfen
Member
41 points
74 Posts
11-06-2009 11:12 PM |
I have a HyperlinkButton with the NavigateUri defined as:
http://localhost/test/test.ppt
navigation is only supported to relative uris that are fragments, or begin with '/', or which contain ';component/'. urimapper
From reading the forums, I know that this has something to do with UriMapping. My MainPage.xaml looks like:
Source="/FencelForm" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
where TestForm is my initial page. This is the default stuff that is generated by visual studio. The HyperlinkButton is in one of the pages that gets navigated to. My understanding is that because my HyperlinkButton has an absolute address the UriMapping should not make any difference. So I am totally confused. I also need to know how to make it work with a relative address because I need it to allow the user to download a file local to the website. Many thanks for your help.
sladapter
All-Star
17441 points
3,172 Posts
11-07-2009 3:31 PM |
If you specify TargetName="_new" or TargetName="_blank" on your HyperlinkButton. You should not get this error.
I'm not sure it is by design. But when you think about it, it has some logic in it. Because without specifying the TargetName, it will navigate away from your Silverlight application. It can not really place the your outside HTML/ppt page (none Silverlight Page) in the NavigationFrame. But with NavigationFrame, people tend to think the new content in the link should be shown in the Frame.
If you look at the HomePage sample, the Hyperlink button on that page uses HyperlinkButtonStyle which is defined in the App.Xaml. You can apply this style to all your HyperlinkButton, so you do not need to specify TargetName on each one, Because it is already set in the Style.
11-07-2009 4:16 PM |
Thank you!!!! This works perfectly. I spent hours trying to figure this out by myself.