Using the launcher to start Internet Explorer from Code in Windows Phone 7.

WindowsPhoneLaunchExternal.zip
Download this file

Currently in the Mix 2010 pre-release of the Windows Phone 7 SDK the  external launchers are still very much under development. But you can already use them to launch the built-in Internet Explorer from your application.

 

All you need to do is to reference the external library “Microsoft.Phone.Tasks” and use the WebBrowserTask class as follows:


 

[…] 

using Microsoft.Phone.Tasks; 

 

namespace WindowsPhoneLaunchExternal

{

    public partial class MainPage : PhoneApplicationPage

    {

        […] 

        private void hyperlinkbuttonExternal_Click(object sender, RoutedEventArgs e)

        {

            WebBrowserTask task = new WebBrowserTask();

            task.URL = textboxUrl.Text;

            task.Show(); 

        }

    }

}

 

 

The super simple sample code shows the difference between the XAML WebBrowser control and the WebBrowserTask.

 

Have fun!

 

About TechPreacher

Technical Evangelist working for Microsoft Switzerland. Focusing on the Internet of Things and Windows development. EV geek and passionate gamer, with a life.
%d bloggers like this: