Open webbrowser with specific url in WP7

2019-05-29 00:48发布

问题:

How would i go about opening the webbrowser with a specific url on button click.

回答1:

Put the following code in the button Click event handler:

var task = new Microsoft.Phone.Tasks.WebBrowserTask
            {
        URL = uri
            };

            task.Show();


回答2:

with this code on button handler event you can navigate to the url assigned to var URL

        WebBrowserTask wbTask = new WebBrowserTask();
        var URL = "http://create.msdn.com";
        wbTask.Uri = new Uri(URL, UriKind.RelativeOrAbsolute);
        wbTask.Show();