How to subscribe an event without setting Control.Delegate to null in a Xamarin.iOS custom renderer

KhuKhu AUMember ✭✭

I need to extend the Xamarin.Forms ListView to have an async method for scroll the list view to top. Create a control and the custom renderer to subscribe the scrolling ended event inside the OnElementchanged override.

Major code:
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.ListView> e)
{
...
//Without settings Delegate to null, I am getting "Event registration is overwriting existing delegate..." error

Control.Delegate = null;

//Below line is actually override the Delegate, and cause some problems (for example the Grouping for the list view is not working )
Control.ScrollAnimationEnded += OnScrolledToTop;
...

}

My questions is how should I do in the custom renderer without setting Control.Delegate to null in this Xamarin.iOS custom renderer?

Many thanks.
Kevin Hu

Answers

Sign In or Register to comment.