In SL4, I am finding it oddly difficult to figure out how to make a HyperlinkButton navigate to another Silverlight page in the same application when clicked. The structure is:
<HyperlinkButton Content="Technical Information Screen" Height="23"
Name="hyperlinkButton1" Width="320" NavigateUri="/tis.xaml" />
“tis.xaml” is in the same folder as MainPage.xaml, which is where this button is located. When clicked, the button raises “404 Not Found”.
If I change to having the NavigateUri get filled programmatically in the MainPage constructor, as in:
hyperlinkButton1.NavigateUri = new Uri("/tis.xaml", UriKind.Relative);
I get the same result, as I do with not decorating with “/”, and with UriKind set to Absolute or RelativeOrAbsolute. It is all very mysterious, but I know it must be do-able somehow, or why have the control at all?
Hyperlink button’s default behavior is to point the browser to a different page (i.e. a whole other HTML page).
Navigation between XAML pages within the same application is explained in detail here (I suppose you will have to call
NavigationService.Navigate()in the click event of the hyperlink button).