Hipervínculos en Xaml para navegar de una página a otra

How can I create Hyperlinks in Xaml to navigate from one page to another page? I don't know actually how to use the hyperlink tags.

preguntado el 28 de mayo de 14 a las 11:05

What did you tried? What failed? Why? -

2 Respuestas

Puedes usar Solicitar Navegar evento para agregar un HyperLink clase

Xaml:

<TextBlock>           
    <Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">
        Click here
    </Hyperlink>
</TextBlock>

Código detrás:

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
    Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
    e.Handled = true;
}

contestado el 28 de mayo de 14 a las 11:05

If you are looking for navigating to another page :

 <StackPanel Grid.Row="1"
        Margin="120,0,120,60">
   <HyperlinkButton Content="Click to go to page 2" Click="HyperlinkButton_Click"/>
</StackPanel>

And handle it like :

 private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
 {
   this.Frame.Navigate(typeof(BasicPage2));
 }

And to move to external page : As mentioned by @Brainy

contestado el 28 de mayo de 14 a las 12:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.