,

Displaying Web Content with the WebBrowser Element

Whereas the phone’s built-in web browser can be launched from your app to view content on an external website, the WebBrowser control allows the user to view content directly from your app.

The WebBrowser control also allows you to host HTML content within your app, something the built-in web browser does not. It provides for static content loaded from a string or via a relative URI to a page located in isolated storage, or for live content from the Web, using an absolute URI. You can generate HTML and pass it to the WebBrowser control at runtime, and you can download content, save it to isolated storage, and display it later. The control responds to touch: a double tap zooms in, and the pinch gesture is also supported.

To have the WebBrowser load content, set the Source property of the URI to the location of the content as demonstrated in the following examples:

<phone:WebBrowser Source="http://www.example.com" />
<phone:WebBrowser Source="{Binding Url}" />

Alternatively, use the WebBrowser’s Navigate method, as shown:

webBrowser.Navigate(
    new Uri("http://www.example.com", UriKind.Absolute));

The Navigate method has an overload that allows you to specify options for including posted form data and HTTP headers.

Loading a page from a string containing HTML is also possible using the NavigateToString method, as shown:

webBrowser.NavigateToString(
    "<html><head /><body>Windows Phone 8 Unleashed</body></html>");

The markup for the page loaded in the WebBrowser can be retrieved at runtime using the WebBrowser.SaveToString method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.82.93