Windows Phone 7 从应用程序导航到互联网

发布于 2024-10-08 22:46:40 字数 523 浏览 0 评论 0原文

我有以下问题: 我有我的 Windows Phone 7 应用程序,并且有一个 HyperlinkBut​​ton,其中 NavigateUri 绑定到如下创建的 Uri

Uri uri = new Uri("http://google/ro",UriKind.Ablosute)

但是当我按下按钮时我收到以下错误:

仅支持相对 URI 进行导航,这些相对 URI 是片段、以“/”开头或包含“;component/”。\r\n参数名称:uri

我做错了什么?或者WP7不允许通过带有HyperlinkBut​​ton的应用程序上网?因为当我创建像 Uri uri = new Uri("/Page.xaml",UriKind.Relative) 这样的 uri 时,它会将我重定向到项目中的 Page.xaml

I have the following question:
I have my Windows Phone 7 appplication and I have a HyperlinkButton with the NavigateUri binded to an Uri created like this:

Uri uri = new Uri("http://google/ro",UriKind.Ablosute)

but when I press the button I get the following error :

Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'.\r\nParameter name: uri

What did I do wrong? Or is the WP7 that does not allow to surf the internet from an application with a HyperlinkButton? Since when I create the uri like Uri uri = new Uri("/Page.xaml",UriKind.Relative) it redirects me to Page.xaml in the project.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ゞ记忆︶ㄣ 2024-10-15 22:46:40

我发现了一个相当奇怪的解决方法来解决这个问题。只需将 TargetName="_blank" 属性添加到 HyperlinkBut​​ton 控件中,它就会神奇地开始工作。

<HyperlinkButton Content="Google" NavigateUri="http://google.com" TargetName="_blank" />

克里斯

I found a rather strange workaround that fixes this. Just add a TargetName="_blank" property to your HyperlinkButton control, and it magically starts working.

<HyperlinkButton Content="Google" NavigateUri="http://google.com" TargetName="_blank" />

Chris

饮湿 2024-10-15 22:46:40

您无法使用手机导航系统导航到网络(您希望它显示在哪里?)。但您可以使用 Web 浏览器控件在应用程序中显示网页。请参阅此 示例

您还可以使用Web 浏览器任务 类似于

WebBrowserTask wtb = new WebBrowserTask();
wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
wtb.Show(); 

You can't use the phone navigation system to navigate to the web (where would you expect it to display?). But you can use the web browser control to display web pages in your app. See this example

You could also use a Web Browser Task something along the lines of

WebBrowserTask wtb = new WebBrowserTask();
wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
wtb.Show(); 
淡淡绿茶香 2024-10-15 22:46:40

URL 已过时。使用 Uri,如下所示。

private void Button_Click(object sender, RoutedEventArgs e)
{
    WebBrowserTask wtb = new WebBrowserTask();
    wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
    wtb.Show();         
}

The URL is obsolete. Use Uri, as below.

private void Button_Click(object sender, RoutedEventArgs e)
{
    WebBrowserTask wtb = new WebBrowserTask();
    wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
    wtb.Show();         
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文