I am usingand I need the user to be able to do both tap which will open popup and scroll down. However now I am able to do only one of these two activites as seems to be unresponsive to Tapgesture.
I implemented this solution not possible and subsituted however now I cannot scroll because the is funny enough too responsive so I get pop up straight away.
_webView.Touch += (object sender, TouchEventArgs eventArgs) => {
if (eventArgs.Event.Action == Android.Views.MotionEventActions.Down)
{
var webview = Element as ExtendedWebView;
webview.OnTouched();
}
};
}
}
<Grid x:Name="scroll">
<controls:ExtendedWebView x:Name="czExplanation" Source="{Binding CZ, Mode=OneWay}" Touched="PopUp">
</controls:ExtendedWebView>
</Grid>
public ExtendedWebView()
{
}
public event EventHandler Touched;
public void OnTouched() =>
Touched?.Invoke(this, null);
public ICommand PannedCommand
{
set { SetValue(PannedCommandProperty, value); }
get { return (ICommand)GetValue(PannedCommandProperty); }
}
public static readonly BindableProperty PannedCommandProperty = BindableProperty.Create(nameof(PannedCommand), typeof(ICommand), typeof(ExtendedWebView));
Update
<controls:ExtendedWebView x:Name="webView" Source="{Binding CZ, Mode=OneWay}" PannedCommand="{Binding PanCommand}" Touched="webView_Touched">
</controls:ExtendedWebView>
public class ExtendedWebViewRenderer : WebViewRenderer
{
public static int _webViewHeight;
static ExtendedWebView _xwebView = null;
public WebView _webView;
bool isScroll;
public ExtendedWebViewRenderer(Context context) : base(context)
{
}
class ExtendedWebViewClient : WebViewClient
{
WebView _webView;
public async override void OnPageFinished(WebView view, string url)
{
try
{
_webView = view;
if (_xwebView != null)
{
view.Settings.JavaScriptEnabled = true;
await Task.Delay(100);
string result = await _xwebView.EvaluateJavaScriptAsync("(function(){return document.body.scrollHeight;})()");
_xwebView.HeightRequest = Convert.ToDouble(result);
}
base.OnPageFinished(view, url);
}
catch (Exception ex)
{
Console.WriteLine($"{ex.Message}");
}
}
public override bool ShouldOverrideUrlLoading(Android.Webkit.WebView view, IWebResourceRequest request)
{
return true;
}
}
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
{
base.OnElementChanged(e);
_xwebView = e.NewElement as ExtendedWebView;
_webView = Control;
if (e.OldElement == null)
{
_webView.SetWebViewClient(new ExtendedWebViewClient());
}
_webView.Touch += (object sender, TouchEventArgs eventArgs) =>
{
switch (e.Event.Action)
{
}