xamarin.forms Handle Clicked event on WebView

后端 未结 5 2257
陌清茗
陌清茗 2020-12-06 12:39

I want to handle the click/tap event on a WebView control

I\'ve tried the GestureRecognizers but nothing happens, i think maybe the WebView has some sort of making t

5条回答
  •  粉色の甜心
    2020-12-06 13:16

    An easier workaround is to use the 'Focused' event on your webview. You can implement it as below:

    var wb = new WebView
    {
      HorizontalOptions = LayoutOptions.FillAndExpand,
      VerticalOptions = LayoutOptions.FillAndExpand,
      Source = "https://stackoverflow.com/questions/56320611/webview-gesturerecognition-not-working-in-xamarin-forms",
    };
    
    wb.Focused += (s, e) =>
    {
       //Handle your logic here!
       wb.Unfocus(); 
    };
    

提交回复
热议问题