Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle HTML content in Windows 8 Metro App

I'm designing a Windows 8 Reader App, and I have to use a control to show the HTML content, which is fetched from some website feeds. Cause those HTML content may contains images or some other formatted text, now I'm using a richtextblock to show the HTML content, but it costs a lot of time to parse the HTML content.

So I'm wondering if there is any controls that can handle the HTML content except the WebView.

Thanks.

Updated: The reason I can't use WebView is that I need to implement pagination, like the image belowed:

enter image description here

like image 880
ellic Avatar asked Jun 04 '12 12:06

ellic


2 Answers

As JP Alioto mentioned you should use the WebView control.

You can use the NavigateToString method to load the HTML. Or use Navigate to request a URI.

There are issues however with using the WebView control, specifically it is rendered differently and is not a standard control, this means things like your app bar or settings pane will not render on top of the WebView, there is a workaround by using the WebViewBrush to "paint" the WebView to standard control such as a rectangle when needed.

like image 140
Marc Gagne Avatar answered Nov 01 '22 15:11

Marc Gagne


Also you can make a screenshot of the webpage you want to display. But to make a screenshot of webpage it's also not easy to do, but I offer you to make it with some special sites wich are created to take screenshot of other websites. Then you can download an image this sites return and open and display it in your windows 8 app. I show You some example how to I did that:

 StorageFolder screens = await Windows.ApplicationModel.Package.Current.InstalledLocation.CreateFolderAsync(@"Screens\" + folderName, CreationCollisionOption.GenerateUniqueName);
 var downloader = new BackgroundDownloader();
 IStorageFile file = await screens.CreateFileAsync(fname, CreationCollisionOption.GenerateUniqueName);
 string my_uri = "http://api.snapito.com/web/e3c351d5994134eb1aea855ce78e296c3292d48a/lc/" + url + "?type=jpeg";
 DownloadOperation download = downloader.CreateDownload(new System.Uri(my_uri), file);
 await download.StartAsync();
like image 25
POF_Andrew_POF Avatar answered Nov 01 '22 13:11

POF_Andrew_POF