I\'m having a bit of trouble loading an html file in a WebView control in a metro style app. I\'ve been searching the internet and found out that you can\'t load a local htm
I ran into the same problem. In my application I have a file called Default.html which is read and it's contents are displayed in a WebView control.
var html = await Windows.Storage.PathIO.ReadTextAsync("ms-appx:///Assets/Default.html");
MyWebView.NavigateToString(html);
Note that I'm using await
and ReadTextAsync
so that the code is asynchronous (as one should when doing IO), the function you place this snipped it must be defined as async, example:
private async void LoadWebView( file ) { ... }