Windows Phone 7 从应用程序导航到互联网
我有以下问题: 我有我的 Windows Phone 7 应用程序,并且有一个 HyperlinkButton
,其中 NavigateUri
绑定到如下创建的 Uri
:
Uri uri = new Uri("http://google/ro",UriKind.Ablosute)
但是当我按下按钮时我收到以下错误:
仅支持相对 URI 进行导航,这些相对 URI 是片段、以“/”开头或包含“;component/”。\r\n参数名称:uri
我做错了什么?或者WP7不允许通过带有HyperlinkButton
的应用程序上网?因为当我创建像 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现了一个相当奇怪的解决方法来解决这个问题。只需将 TargetName="_blank" 属性添加到 HyperlinkButton 控件中,它就会神奇地开始工作。
克里斯
I found a rather strange workaround that fixes this. Just add a TargetName="_blank" property to your HyperlinkButton control, and it magically starts working.
Chris
您无法使用手机导航系统导航到网络(您希望它显示在哪里?)。但您可以使用 Web 浏览器控件在应用程序中显示网页。请参阅此 示例
您还可以使用Web 浏览器任务 类似于
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
URL
已过时。使用Uri
,如下所示。The
URL
is obsolete. UseUri
, as below.