I need to add a hyperlink button that directs to a webpage to my metro style apps written with C# and XAML. As in Silverlight, there is no NavigateURI option. Is there any other option to make a hyperlink redirect to a specific webpage?
There's a sample in the Sample App Pack that does this.
// Launch a URI.
private async void LaunchUriButton_Click(object sender, RoutedEventArgs e)
{
// Create the URI to launch from a string.
var uri = new Uri(uriToLaunch);
// Launch the URI.
bool success = await Windows.System.Launcher.LaunchUriAsync(uri);
if (success)
{
rootPage.NotifyUser("URI launched: " + uri.AbsoluteUri, NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("URI launch failed.", NotifyType.ErrorMessage);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With