Yesterday (July 21, 2012) I spent the day at a Windows 8 DevCamp, and had a lot of support from Microsoft starting to get our Travel Advisories App ported to Windows 8.
The app renders html using the WebView control, but in trying to port it, I ran into a number of problems.
The first problem I encountered was that there is no equivalent of the OnNavigating event, raised by the WP7 control. In WP7, what we did was perform a WebBrowserTask.Show() on containing whatever page was being navigated to.
Launching the web browser wasn’t that great of an experience on Win 8 in any case, so I decided I’d put that on hold. That’s when the second problem appeared.
We construct the first page shown in the app in memory, and then use NavigateToString. Unfortunately, the page doesn’t appear to accept clicks or navigate reliably when you first navigate. Resizing the app on Win8 appears to make the WebView finally show it’s scroll bars, and take navigation hits. On that note, I took the train back to Cambridge.
This morning I had a few more ideas. I thought, that since I can’t pop open a new web browser on navigate, I’d try to handle the navigation to a new page in the app. I do this by using the LoadCompleted event.
Unfortunately, this event isn’t reliably raised on a new page, nor is the NavigationFailed event.
Unfortunately, while this occasionally works, it also occasionally throws an exception.
So, all in all, I think the message in all this is: If your app needs an HTML viewer, your in for a world of pain. I don’t know if this will be resolved before Win8 ships, as apparently it’s RTM in just 8 days.