internal static bool TryRemoveManipulator(UIElement element, IManipulator manipulator) { ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { device.RemoveManipulator(manipulator); return(true); } return(false); }
internal static bool TryCompleteManipulation(UIElement element) { ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { device.CompleteManipulation(/* withInertia = */ false); return(true); } return(false); }
private static ManipulationDevice GetActiveManipulationDevice(UIElement element) { Debug.Assert(element != null, "element should be non-null."); ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if ((device != null) && device.IsManipulationActive) { return(device); } return(null); }
/// <summary> /// If a manipulation is active, forces the manipulation to proceed to the inertia phase. /// If inertia is already occurring, it will restart inertia. /// </summary> /// <param name="element">The element on which there is an active manipulation.</param> public static void StartInertia(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { device.CompleteManipulation(/* withInertia = */ true); } }
/// <summary> /// Retrieves the pivot for single-finger manipulation on an active manipulation. /// </summary> /// <param name="element">The element on which there is an active manipulation.</param> /// <returns>The pivot for single-finger manipulation.</returns> public static ManipulationPivot GetManipulationPivot(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { return(device.ManipulationPivot); } return(null); }
/// <summary> /// Retrieves the container that defines the coordinate space of event data /// for an active manipulation. /// </summary> /// <param name="element">The element on which there is an active manipulation.</param> /// <returns>The container that defines the coordinate space.</returns> public static IInputElement GetManipulationContainer(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { return(device.ManipulationContainer); } return(null); }
/// <summary> /// Retrieves the current manipulation mode of an active manipulation. /// </summary> /// <param name="element">The element on which there is an active manipulation.</param> /// <returns>The current manipulation mode.</returns> public static ManipulationModes GetManipulationMode(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element); if (device != null) { return(device.ManipulationMode); } else { return(ManipulationModes.None); } }