Results 1 to 4 of 4

Thread: [RESOLVED] hyperlink in code vb.net silverlight 2010

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Posts
    778

    Resolved [RESOLVED] hyperlink in code vb.net silverlight 2010

    Hello,

    I was looking for how to simply use the browser of the phone to jump to a link from my application.

    I found what seems to be used in c# which looks reasonable:

    http://forums.silverlight.net/t/163160.aspx/1
    Code:
    System.Windows.Browser.HtmlPage.Window.Navigate(FullNaviagteURI)
    I just want to know how to do this in VB.net, the reason I am not using a hyperlinkButton is because I am binding some titles and they don't fit on one line and the hyperlinkButton cannot wrap text so I need to do this on tap in code

    Please advise

  2. #2
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008
    Location
    WY
    Posts
    1,227

    Re: hyperlink in code vb.net silverlight 2010

    Wrapping style for a hyperlink button: http://www.pitorque.de/MisterGoodcat...ton-style.aspx

    Here's the C# code translated

    Code:
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs) Handles Button.Click
    	Dim url As New Uri(TryCast(sender, Button).Tag.ToString(), UriKind.Absolute)
    	HtmlPage.Window.Navigate(url, "_blank")
    End Sub
    I would recommend creating the 1st option myself.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Posts
    778

    Re: hyperlink in code vb.net silverlight 2010

    Hi, thanks for reply

    I get this error:

    'HtmlPage' is not declared. It may be inaccessible due to its protection level.

    HtmlPage comes from System.Windows.Browser as I found in the msdn documentation, but I don't seem to have it in the references list. I also forgot to mention this is Windows Phone app using Visual Studio for Windows Phone if that makes any difference.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Posts
    778

    Re: hyperlink in code vb.net silverlight 2010

    Hi again,

    I actually just discovered this code that works ! :

    Code:
    WebBrowserTask task = new WebBrowserTask();
     task.URL = "http://www.stackoverflow.com";
     task.Show();

    Thanks for help, resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width