Why does this Hyperlink fail or disappear?

I tried to replace the second of these two buttons:

    <Button x:Name="buttonRecordWhereabouts" Margin="24" Tap="ButtonRecordWhereabouts_OnTap">Record My Whereabouts...</Button>
    <Button x:Name="buttonlinkManageInvitations" Grid.Row="1" Tap="ButtonlinkManageInvitations_OnTap">Manage Invitations...</Button>

...with this hyperlink:

    <Hyperlink x:Name="hyperlinkManageInvitations" Grid.Row="1" Click="HyperlinkManageInvitations_OnClick">Manage Invitations...</Hyperlink>

...and use this code in the hyperlink's Click handler:

private void HyperlinkManageInvitations_OnClick(object sender, RoutedEventArgs e)
{
    NavigationService.Navigate(
        new Uri("//TaSLs_Pages/InvitationManagePage.xaml", UriKind.Relative));
}

However, doing so caused the XAML editor to stop rendering my page, as the "Grid.Row="1"" was unrecognized. ??? So I removed it, and that resolved the syntax error, but not only the hyperlink, but also the button before it "went away" - that is to say, they weren't visible on the page any longer.

So it's not possible to place a Hyperlink in a particular cell (column 0, row 1 in my case), or what?

As of now, I've got the hyperlink's click event code in the button's (I put it back for now) Tap event; is this the way to navigate in Windows Phone (as opposed to the Frame.Navigate(typeof()) in Windows Store apps?

Upvotes: 0

Views: 154

Answers (1)

Kevin Gosse
Kevin Gosse

Reputation: 39007

Hyperlink is meant to be used inside of a RichTextBox. In your case, you're supposed to use HyperlinkButton.

<HyperlinkButton x:Name="hyperlinkManageInvitations" Grid.Row="1" Click="HyperlinkManageInvitations_OnClick">Manage Invitations...</HyperlinkButton>

Upvotes: 2

Related Questions