Example #1
0
        protected override void OnNextGesture(Gesture gesture)
        {
            if (!this.IsEnabled)
            {
                return;
            }

            switch (gesture.Type)
            {
                case GestureType.LeftButtonDown:
                    this.isLeftButtonDown = true;

                    if (this.CaptureMouse())
                    {
                        this.IsPressed = true;
                    }

                    break;
                case GestureType.LeftButtonUp:
                    this.isLeftButtonDown = false;

                    if (this.IsPressed)
                    {
                        this.OnClick();
                    }

                    this.ReleaseMouseCapture();
                    this.IsPressed = false;
                    break;
                case GestureType.Move:
                    if (this.isLeftButtonDown && this.IsMouseCaptured)
                    {
                        this.IsPressed = this.HitTest(gesture.Point);
                    }

                    break;
            }
        }
Example #2
0
        protected override void OnNextGesture(Gesture gesture)
        {
            switch (gesture.Type)
            {
                case GestureType.LeftButtonDown:
                    this.CaptureMouse();
                    break;
                case GestureType.FreeDrag:
                    if (this.scrollInfo != null && this.IsMouseCaptured)
                    {
                        this.scrollInfo.SetHorizontalOffset(this.scrollInfo.Offset.X - gesture.Delta.X);
                        this.scrollInfo.SetVerticalOffset(this.scrollInfo.Offset.Y - gesture.Delta.Y);
                    }

                    break;
                case GestureType.LeftButtonUp:
                    if (this.IsMouseCaptured)
                    {
                        this.ReleaseMouseCapture();
                    }

                    break;
            }
        }
Example #3
0
 protected virtual void OnNextGesture(Gesture gesture)
 {
 }
Example #4
0
        private static bool OnNextGestureFindElement(IElement element, Gesture gesture)
        {
            if (element is IInputElement && element.HitTest(gesture.Point))
            {
                element.Gestures.OnNext(gesture);
                return true;
            }

            return false;
        }
Example #5
0
 private static bool OnNextGestureFindChild(IElement element, Gesture gesture)
 {
     return
         element.GetVisualChildren().Reverse().Where(child => !OnNextGestureFindChild(child, gesture)).Any(
             child => OnNextGestureFindElement(child, gesture));
 }
Example #6
0
 protected override void OnNextGesture(Gesture gesture)
 {
     if (this.elementWithMouseCapture != null)
     {
         this.elementWithMouseCapture.Gestures.OnNext(gesture);
     }
     else
     {
         if (!OnNextGestureFindChild(this, gesture))
         {
             OnNextGestureFindElement(this, gesture);
         }
     }
 }