void UpdateManipulationMode() { ManipulationModes modes = (_element.ManipulationMode == (ManipulationModes.None | ManipulationModes.System)) ? ManipulationModes.None : _element.ManipulationMode; if (_mode.TranslateRailX()) { modes |= ManipulationModes.None | ManipulationModes.TranslateRailsX | ManipulationModes.TranslateX; } if (_mode.TranslateRailY()) { modes |= ManipulationModes.None | ManipulationModes.TranslateRailsY | ManipulationModes.TranslateY; } if (_mode.TranslateX()) { modes |= ManipulationModes.None | ManipulationModes.TranslateX; } if (_mode.TranslateY()) { modes |= ManipulationModes.None | ManipulationModes.TranslateY; } if (_mode.IsInertial()) { modes |= ManipulationModes.None | ManipulationModes.TranslateInertia; } _element.ManipulationMode = modes; }
void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) { if (_manipulationStarted) { Point translation = e.Delta.Translation; Point point2 = e.Cumulative.Translation; if (!_dragStarted && (((Math.Abs(point2.X) > _actualInitialThreshold) && _actualMode.TranslateX()) || ((Math.Abs(point2.Y) > _actualInitialThreshold) && _actualMode.TranslateY()))) { Start(e); } if (_dragStarted) { _cumulativeTranslation = new Point(_cumulativeTranslation.X + translation.X, _cumulativeTranslation.Y + translation.Y); RaiseDragDelta(e, _cumulativeTranslation, translation, e.IsInertial); } } }