protected override void DisconnectHandler(SKCanvasView nativeView) { touchHandler?.Detach(nativeView); touchHandler = null; nativeView.PaintSurface -= OnPaintSurface; base.DisconnectHandler(nativeView); }
protected override void Dispose(bool disposing) { // detach all events before disposing var controller = (ISKCanvasViewController)Element; if (controller != null) { controller.SurfaceInvalidated -= OnSurfaceInvalidated; controller.GetCanvasSize -= OnGetCanvasSize; } var control = Control; if (control != null) { control.PaintSurface -= OnPaintSurface; } // detach, regardless of state touchHandler.Detach(control); base.Dispose(disposing); }