public void Unsubscribe() { _element.ManipulationStarted -= OnManipulationStarted; _element.ManipulationCompleted -= OnManipulationCompleted; _element.ManipulationDelta -= OnManipulationDelta; TouchHelper.RemoveHandlers(_element); if (_doubleTap != null) { _doubleTap.Cancel(); _doubleTap = null; } if (_tapAndHold != null) { _tapAndHold.Cancel(); _tapAndHold = null; } if (_pressAndTap != null) { _pressAndTap.Cancel(); _pressAndTap = null; } }
private void Subscribe(UIElement element) { _element = element; _element.ManipulationStarted += OnManipulationStarted; _element.ManipulationCompleted += OnManipulationCompleted; _element.ManipulationDelta += OnManipulationDelta; TouchHelper.AddHandlers(_element, new TouchHandlers { TouchDown = OnTouchDown, CapturedTouchUp = OnCapturedTouchUp, CapturedTouchReported = OnTouchReported }); TouchHelper.EnableInput(true); }