Last active
August 29, 2015 14:10
-
-
Save arn-ob/f04f0695f97d7904683c to your computer and use it in GitHub Desktop.
WebView code at WinPhon 8.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
paste this to xaml page | |
<WebView x:Name="WebViewControl" | |
HorizontalAlignment="Stretch" | |
VerticalAlignment="Stretch" | |
NavigationCompleted="Browser_NavigationCompleted" /> | |
*/ | |
public sealed partial class <xaml_page_name> : Page | |
{ | |
// Replace <html> with your URL here. | |
// copy all your web doc into a folder then locate the index.html at the code .... | |
// ex : private static readonly Uri HomeUri = new Uri("ms-appx-web:///Html/index.html", UriKind.Absolute); | |
private static readonly Uri HomeUri = new Uri("ms-appx-web://<html>", UriKind.Absolute); | |
public <xaml_page_name>() | |
{ | |
this.InitializeComponent(); | |
} | |
protected override void OnNavigatedTo(NavigationEventArgs e) | |
{ | |
WebViewControl.Navigate(HomeUri); | |
} | |
private void Browser_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args) | |
{ | |
if (!args.IsSuccess) | |
{ | |
Debug.WriteLine("Navigation to this page failed, check your internet connection."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment