我需要向使用 C# 和 XAML 编写的 Metro 风格应用程序添加指向网页的超链接按钮。与在 Silverlight 中一样,没有 NavigateURI 选项。是否有任何其他选项可以将超链接重定向到特定网页?
最佳答案
示例应用程序包中有一个示例可以执行此操作。
// 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);
}
}
关于c# - 使用 Visual Studio 11 (Windows 8) 在 XAML 中添加超链接按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9306468/