Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

LoadFinished event never called on HybridWebView

$
0
0

I am using HybridWebView in my app and want to show loading activity indicator while page is loading using the following code. However the LoadFinished event is never called. Not sure what am I missing here-

        var layout = new StackLayout ();

        var loadingLabel = new Label (){ Text = "Loading...." , HorizontalOptions=LayoutOptions.CenterAndExpand};
        var activityIndicator = new ActivityIndicator (){IsRunning=true};
        var loadingLayout = new StackLayout (){ Children = { activityIndicator, loadingLabel },HorizontalOptions=LayoutOptions.CenterAndExpand};
        loadingLayout.IsVisible = true;
        layout.Children.Add(loadingLayout);

        var webView=new HybridWebView(){HorizontalOptions=LayoutOptions.FillAndExpand, VerticalOptions=LayoutOptions.FillAndExpand};
        webView.SetBinding (WebView.SourceProperty, new Binding ("CurrentSource"));



        webView.LoadFinished += (s, e) => {
            activityIndicator.IsRunning=false;
            loadingLayout.IsVisible = false;
        };
        layout.Children.Add (webView);
        Content = layout;

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>