WP7 Phone Capabilities

Note to self.  When adding a Web Browser to a Windows Phone 7 page like this:

<phone:WebBrowser x:Name="HelpBrowser"
                    Grid.Row="1"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    />

and code up a navigation like this:

public GameInformation()
        {
            InitializeComponent();
            this.HelpBrowser.Loaded += new RoutedEventHandler(HelpBrowser_Loaded);
        }

        void HelpBrowser_Loaded(object sender, RoutedEventArgs e)
        {
            this.HelpBrowser.Navigate(new Uri(Constants.HelpDocumentsLocation, UriKind.Absolute));
        }

and you get an exception like this:

image

You are forgetting the capabilities section of the phone app for web browsers.  The inner exception about privileges gives it away (short of actually telling you what happened).  Just add this to the WMAPPManifest.xml file:

<Capabilities>
      <Capability Name="ID_CAP_NETWORKING" />
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: