I'm changing the WebViewRenderer to WkWebViewRenderer in My Xamarin Forms app. I earlier had the Scrolled method which I override to detect scrolled to end. But no such method is available in the WkWebViewRenderer. How else can this be implemented?
public override void Scrolled(UIKit.UIScrollView scrollView)
{
base.Scrolled(scrollView);
float y1 = (float)scrollView.ContentOffset.Y;
if ((this.Element as CustomWebview).ScrolledToEnd == false)
{
if ((scrollView.ContentSize.Height - 20) < (y1 + this.Element.Height))
{
(this.Element as CustomWebview).ScrolledToEnd = true;
if ((this.Element as CustomWebview).ScrollToEndDelegate != null)
{
(this.Element as CustomWebview).ScrollToEndDelegate.Invoke(true);
}
}
}
}
Okay, so I figured that now instead of the Scrolled method, we can now use The scrolled event inside the ScrollView property of WkWebView. This works for me:
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
base.ScrollView.Scrolled += ScrollDetect;
}
private void ScrollDetect(object sender, EventArgs e)
{
throw new NotImplementedException();
}