2017-09-11 4 views
0

PCL 프로젝트가 있고 최근에 Xamarin 폼을 버전 2.3.4.270으로 업데이트했지만이 버전으로 업데이트하면 webview.navigated() 이벤트가 실행되지 않습니다.Xamarin Forms Webview 탐색 이벤트

var browser = new BaseUrlWebView(); 
var htmlSource = new HtmlWebViewSource(); 

    htmlSource.Html = @"<html> 
     <head> 
     <link rel=""stylesheet"" href=""default.css""> 
     </head> 
     <body> 
     <h1>Xamarin.Forms</h1> 
     <p>The CSS and image are loaded from local files!</p> 
     <img src='XamarinLogo.png'/> 
     <p><a href=""local.html"">next page</a></p> 
     </body> 
     </html>"; 

    htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get(); 

    browser.Navigated += (sender, e) => { 
     this.DisplayAlert("Navigated", "Navigated the page", "Cancel"); 
    }; 

    browser.Source = htmlSource; 


    Content = browser; 

답변

0

var browser = new BaseUrlWebView();

var htmlSource = new HtmlWebViewSource();

htmlSource.Html = @ "일부 HTML";

htmlSource.BaseUrl = DependencyService.Get() .Get();

browser.Source = htmlSource;

browser.Navigated + = WebViewOnNavigated;

콘텐츠 = 브라우저;

개인 비동기식 공극 WebViewOnNavigated (객체 송신자 WebNavigatedEventArgs E) {

await DisplayAlert("Navigated", "Navigated the page", "Cancel"); 

}

관련 문제