Windows Phone 7 从应用程序导航到 Internet [英] Windows Phone 7 navigation to internet from an application

查看:26
本文介绍了Windows Phone 7 从应用程序导航到 Internet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:我有我的 Windows Phone 7 应用程序,我有一个 HyperlinkBut​​tonNavigateUri 绑定到 Uri 像这样创建:

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 :

仅支持以片段形式、以/"开头或包含;component/"的相对 URI 进行导航. 参数名称:uri

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

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

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.

推荐答案

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

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" />

克里斯

这篇关于Windows Phone 7 从应用程序导航到 Internet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆