Ejemplo n.º 1
0
        internal static bool TryRemoveManipulator(UIElement element, IManipulator manipulator)
        {
            ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element);

            if (device != null)
            {
                device.RemoveManipulator(manipulator);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        internal static bool TryCompleteManipulation(UIElement element)
        {
            ManipulationDevice device = ManipulationDevice.GetManipulationDevice(element);

            if (device != null)
            {
                device.CompleteManipulation(/* withInertia = */ false);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        /// <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);
            }
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
        /// <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);
            }
        }