Beispiel #1
0
        protected override void OnAttached()
        {
            base.OnAttached();

            this.timer = new DispatcherTimer();
            this.AssociatedObject.IsManipulationEnabled = true;
            // Insert code that you would want run when the Behavior is attached to an object.
            this.AssociatedObject.PreviewTouchDown += AssociatedObject_PreviewTouchDown;
            this.AssociatedObject.PreviewTouchMove += AssociatedObject_PreviewTouchMove;
            this.AssociatedObject.PreviewTouchUp   += AssociatedObject_PreviewTouchUp;

            this.sensitiveFactor = new GestureSensitive(1.0, 1.0);
            this.timer.Tick     += new EventHandler(timer_Tick);
            this.timer.Interval  = new TimeSpan(0, 0, 0, 0, GestureConsts.Current.PressAndHoldInterval);
        }
Beispiel #2
0
 public void SetSensitiveCallBack(GestureSensitive sensitiveFactor)
 {
     this.sensitiveFactor = sensitiveFactor;
 }
Beispiel #3
0
        public static void AttachTouchOperation(this FrameworkElement element, Action <GestureArg> callback, GestureSensitive sensiveFactor, Action <GestureArg, Vector, Vector> gestureDetalBehavior = null)
        {
            GestureCheckBehavior behavior = new GestureCheckBehavior();

            behavior.OnGestureDetector += (ele, arg) =>
            {
                callback((GestureArg)arg);
            };
            behavior.SetCallBack(gestureDetalBehavior);
            Interaction.GetBehaviors(element).Add(behavior);
        }
 public GestureDetectorBehavior()
 {
     this.sensitiveFactor = new GestureSensitive(1.0, 1.0);
 }
Beispiel #5
0
        public static void AttachGestureDetector(this FrameworkElement element, Action <GestureArg> callback, GestureSensitive sensiveFactor, Action <GestureArg, ManipulationDelta, ManipulationDelta> gestureDetalBehavior = null, Action <GestureArg> gestureStatusBehavior = null)
        {
            GestureDetectorBehavior behavior = new GestureDetectorBehavior();

            if (gestureDetalBehavior != null)
            {
                behavior.SetContinueCallBack(gestureDetalBehavior);
            }

            if (gestureStatusBehavior != null)
            {
                behavior.SetStatusCallBack(gestureStatusBehavior);
            }

            if (sensiveFactor != null)
            {
                behavior.SetSensitiveCallBack(sensiveFactor);
            }

            behavior.OnGestureDetector += (ele, arg) =>
            {
                callback((GestureArg)arg);
            };
            Interaction.GetBehaviors(element).Add(behavior);
        }