c# - 使用 Visual Studio 11 (Windows 8) 在 XAML 中添加超链接按钮

标签 c# xaml windows-8 microsoft-metro visual-studio-2012

我需要向使用 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/

相关文章:

C# 7 使用模式匹配不起作用

c# - 无法将类型 System.Linq.Expression<System.Func<Object, bool>> 隐式转换为 bool

c# - VS2015 : Default Universal App template causes XAML designer crash

c# - 将属性的效果级联到子类中的重写属性

.net - 代码和 XAML 中图像 URI 行为的区别

.net - XAML 性能 : Set alpha channel of a brush vs. FrameworkElement 的不透明度

c# - 获取 VariableSizedWrapGrid 进行虚拟化

callback - PowerRegisterSuspendResumeNotification - 提供的回调函数未按预期工作

c# - 当用户更新我的应用程序时,本地存储会被删除吗?

c# - 如何使用 Coypu 和 C# 获取 InnerText?