Windows Phone 7从应用程序导航到Internet [英] Windows Phone 7 navigation to internet from an application
问题描述
我有以下问题:
我有我的Windows Phone 7应用程序,我有一个 HyperlinkButton
,带有 NavigateUri
绑定到 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 :
导航仅支持作为片段的相对URI,或以'/'开头,或者包含'; component /'。\\\\ n参数名称:uri
Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'.\r\nParameter name: uri
我做错了什么?或者WP7不允许使用 HyperlinkButton
从应用程序上网?从我创建uri时就像 Uri uri = new Uri(/ Page.xaml,UriKind.Relative)
它将我重定向到 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属性添加到您的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.
<HyperlinkButton Content="Google" NavigateUri="http://google.com" TargetName="_blank" />
Chris
这篇关于Windows Phone 7从应用程序导航到Internet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!