WP7 Phone Capabilities
January 17, 2012 Leave a comment
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:
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" />