protected virtual void OnDestroy() { StopGestureRecognizer(); if (gestureRecognizer != null) { gestureRecognizer.TappedEvent -= OnTappedEvent; gestureRecognizer.HoldStartedEvent -= OnHoldStartedEvent; gestureRecognizer.HoldCompletedEvent -= OnHoldCompletedEvent; gestureRecognizer.HoldCanceledEvent -= OnHoldCanceledEvent; gestureRecognizer.ManipulationStartedEvent -= OnManipulationStartedEvent; gestureRecognizer.ManipulationUpdatedEvent -= OnManipulationUpdatedEvent; gestureRecognizer.ManipulationCompletedEvent -= OnManipulationCompletedEvent; gestureRecognizer.ManipulationCanceledEvent -= OnManipulationCanceledEvent; gestureRecognizer.Dispose(); } if (navigationGestureRecognizer != null) { navigationGestureRecognizer.NavigationStartedEvent -= OnNavigationStartedEvent; navigationGestureRecognizer.NavigationUpdatedEvent -= OnNavigationUpdatedEvent; navigationGestureRecognizer.NavigationCompletedEvent -= OnNavigationCompletedEvent; navigationGestureRecognizer.NavigationCanceledEvent -= OnNavigationCanceledEvent; navigationGestureRecognizer.Dispose(); } }
protected override void OnDestroy() { if (gestureRecognizer != null) { gestureRecognizer.StopCapturingGestures(); gestureRecognizer.TappedEvent -= OnTappedEvent; gestureRecognizer.HoldStartedEvent -= OnHoldStartedEvent; gestureRecognizer.HoldCompletedEvent -= OnHoldCompletedEvent; gestureRecognizer.HoldCanceledEvent -= OnHoldCanceledEvent; gestureRecognizer.ManipulationStartedEvent -= OnManipulationStartedEvent; gestureRecognizer.ManipulationUpdatedEvent -= OnManipulationUpdatedEvent; gestureRecognizer.ManipulationCompletedEvent -= OnManipulationCompletedEvent; gestureRecognizer.ManipulationCanceledEvent -= OnManipulationCanceledEvent; gestureRecognizer.Dispose(); } base.OnDestroy(); }