Пример #1
0
        void element_ManipulationInertiaStarting(object sender, System.Windows.Input.ManipulationInertiaStartingEventArgs e)
        {
            if (this.Element == null)
            {
                e.Cancel();
                return;
            }

            //start inertia on all gesture
            Gestures.ForEach(a => a.ManipulationInertiaStarting(e));

            //Debug.WriteLine("OnManipulationInertiaStarting");
            double ms = 1000.0;


            //base.OnManipulationInertiaStarting(e);
            // Decrease the velocity of the Rectangle's movement by
            // 10 inches per second every second.
            // (10 inches * 96 pixels per inch / 1000ms^2)
            //e.TranslationBehavior.DesiredDeceleration = 10 * 96.0 / (1000.0 * 1000.0);
            e.TranslationBehavior = new InertiaTranslationBehavior()
            {
                InitialVelocity     = e.InitialVelocities.LinearVelocity,
                DesiredDeceleration = 10.0 * 96.0 / (ms * ms)
            };

            // Decrease the velocity of the Rectangle's resizing by
            // 0.1 inches per second every second.
            // (0.1 inches * 96 pixels per inch / (1000ms^2)
            //e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / 1000.0 * 1000.0;
            e.ExpansionBehavior = new InertiaExpansionBehavior()
            {
                InitialVelocity     = e.InitialVelocities.ExpansionVelocity,
                DesiredDeceleration = 0.1 * 96 / ms * ms
            };

            // Decrease the velocity of the Rectangle's rotation rate by
            // 2 rotations per second every second.
            // (2 * 360 degrees / (1000ms^2)
            //e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);
            e.RotationBehavior = new InertiaRotationBehavior()
            {
                InitialVelocity     = e.InitialVelocities.AngularVelocity,
                DesiredDeceleration = 720 / (ms * ms)
            };


            e.Handled = true;
        }
Пример #2
0
        void element_ManipulationStarting(object sender, System.Windows.Input.ManipulationStartingEventArgs args)
        {
            if (this.Element == null)
            {
                args.Cancel();
                return;
            }
            //apply gestures
            Gestures.ForEach(a => a.ManipulationStarting(args));

            //get element to top
            this.OnWantToTop();

            //Debug.WriteLine("OnManipulationStarting");
            args.ManipulationContainer = this.ManipulationContainer;

            args.Handled = true;
        }