Chapter 16. Using the WebBrowser Control

You will learn about the WebBrowser control, how to use it to display content from a web page, and how to pass data between your application and the web page.

USING THE WEBBROWSER CONTROL

You can use the WebBrowser control to display HTML content within your application. You can display pages that you have included with your application in the .xap file, or you can load pages from websites.

When using the WebBrowser control, you first need to understand that this control is not a fully functional web browser. It does not display an address bar in which the user can enter a URI. The best way to think of the WebBrowser control is as something similar to an iframe.

You might find the WebBrowser control useful for displaying content within your application that might change in the future, because this will enable you to change the content without releasing a new version of your software. You might also choose to use the WebBrowser control to record a user's acceptance of the terms of use for an application.

Detecting Connection Status

Before attempting to load a web page from a website on the Internet, you will want to check the status of the phone's connection. If the user has a connection via WiFi or a phone network such as 3G, you will proceed to load the intended page from the Internet. If there is no connection, you can load a static page that you have included in the application, or display an error message to the user.

You can check the phone's ...

Get Windows® Phone 7 Application Development 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.