Windows Phone 7 navigation to internet from an application

前端 未结 3 1957
说谎
说谎 2021-01-17 11:06

I have the following question: I have my Windows Phone 7 appplication and I have a HyperlinkButton with the NavigateUri binded to an Uri

相关标签:
3条回答
  • 2021-01-17 11:28

    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

    WebBrowserTask wtb = new WebBrowserTask();
    wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
    wtb.Show(); 
    
    0 讨论(0)
  • 2021-01-17 11:32

    The URL is obsolete. Use Uri, as below.

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        WebBrowserTask wtb = new WebBrowserTask();
        wtb.Uri = new Uri("http://www.google.com", UriKind.Absolute); 
        wtb.Show();         
    }
    
    0 讨论(0)
  • 2021-01-17 11:47

    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

    0 讨论(0)
提交回复
热议问题