如何在Silverlight中导航到Project外的页面 [英] How to Navigate to A page outside Project in Silverlight
问题描述
大家好,
我的问题是,是否无论如何我们都可以从XAML页面导航到www网站?
例如,我有一个按钮,单击时应打开新页面并加载Google主页("www.google.com")
我的代码是
Hello All,
My Question is if there is anyway that we can navigate from a XAML page to a www website?
For Example, I have a button which on click should Open New Page and load Google Home Page ("www.google.com")
My Code is
<HyperlinkButton Content="Click Here to Open Google" Name="GGL" Click="GGL_Click" Foreground="Gray" IsTabStop="False" Tag="www.google.com" />
而我后面的代码是
and my code behind is
Dim GGLButton As HyperlinkButton = DirectCast(sender, HyperlinkButton)
Dim viewsource As String = GGLButton.Tag.ToString
HelpingHand.Navigate(New Uri(viewsource, UriKind.Relative))
我得到的错误是
Navigation is only supported to relative URIs that are fragments, or begin with ''/'', or which contain '';component/''. Parameter name: uri
当我尝试导航到项目内部的页面时,此方法有效.
The Error that I get is
Navigation is only supported to relative URIs that are fragments, or begin with ''/'', or which contain '';component/''. Parameter name: uri
This works when I try to navigate to a page inside my project. Please assist me in this.
推荐答案
尝试使用"UriKind.Absolute"而不是"UriKind.Relative"
Try using ''UriKind.Absolute'' rather than ''UriKind.Relative''
这篇关于如何在Silverlight中导航到Project外的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!