Esempio n. 1
0
        void Target_MouseMove(object sender, MouseEventArgs e)
        {
            if (IsDown)
            {
                DeltaDelta    = e.GetPosition(null) - CurrentPoint;
                CurrentPoint += DeltaDelta;

                if (!IsActive)
                {
                    if (Math.Abs(Delta.X) >= SystemParameters.MinimumHorizontalDragDistance ||
                        Math.Abs(Delta.Y) >= SystemParameters.MinimumVerticalDragDistance)
                    {
                        IsActive        = true;
                        CurrentListener = this;

                        if (Started != null)
                        {
                            Started(this);
                        }
                    }
                }

                if (IsActive && Changed != null)
                {
                    Changed(this);
                }
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            upButton   = (DragRepeatButton)Template.FindName("PART_UpButton", this);
            downButton = (DragRepeatButton)Template.FindName("PART_DownButton", this);
            textBox    = (TextBox)Template.FindName("PART_TextBox", this);

            upButton.Click   += upButton_Click;
            downButton.Click += downButton_Click;

            textBox.LostFocus += (sender, e) => OnLostFocus(e);

            var upDrag   = new DragListener(upButton);
            var downDrag = new DragListener(downButton);

            upDrag.Started   += drag_Started;
            upDrag.Changed   += drag_Changed;
            upDrag.Completed += drag_Completed;

            downDrag.Started   += drag_Started;
            downDrag.Changed   += drag_Changed;
            downDrag.Completed += drag_Completed;

            Print();
        }
Esempio n. 3
0
        void Complete()
        {
            IsActive        = false;
            CurrentListener = null;

            if (Completed != null)
            {
                Completed(this);
            }
        }
Esempio n. 4
0
		void Target_MouseMove(object sender, MouseEventArgs e)
		{
			if (IsDown) {
				DeltaDelta = e.GetPosition(null) - CurrentPoint;
				CurrentPoint += DeltaDelta;

				if (!IsActive) {
					if (Math.Abs(Delta.X) >= SystemParameters.MinimumHorizontalDragDistance ||
					    Math.Abs(Delta.Y) >= SystemParameters.MinimumVerticalDragDistance) {
						IsActive = true;
						CurrentListener = this;

						if (Started != null) {
							Started(this);
						}
					}
				}

				if (IsActive && Changed != null) {
					Changed(this);
				}
			}
		}
Esempio n. 5
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            upButton   = (DragRepeatButton)Template.FindName("PART_UpButton", this);
            downButton = (DragRepeatButton)Template.FindName("PART_DownButton", this);
            textBox    = (TextBox)Template.FindName("PART_TextBox", this);

            upButton.Click   += new RoutedEventHandler(upButton_Click);
            downButton.Click += new RoutedEventHandler(downButton_Click);

            var upDrag   = new DragListener(upButton);
            var downDrag = new DragListener(downButton);

            upDrag.Started   += drag_Started;
            upDrag.Changed   += drag_Changed;
            upDrag.Completed += drag_Completed;

            downDrag.Started   += drag_Started;
            downDrag.Changed   += drag_Changed;
            downDrag.Completed += drag_Completed;

            Print();
        }
Esempio n. 6
0
        void Complete()
        {
            IsActive = false;
            CurrentListener = null;

            if (Completed != null) {
                Completed(this);
            }
        }
Esempio n. 7
0
		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			upButton = (DragRepeatButton)Template.FindName("PART_UpButton", this);
			downButton = (DragRepeatButton)Template.FindName("PART_DownButton", this);
			textBox = (TextBox)Template.FindName("PART_TextBox", this);

			upButton.Click += new RoutedEventHandler(upButton_Click);
			downButton.Click += new RoutedEventHandler(downButton_Click);

			var upDrag = new DragListener(upButton);
			var downDrag = new DragListener(downButton);

			upDrag.Started += drag_Started;
			upDrag.Changed += drag_Changed;
			upDrag.Completed += drag_Completed;

			downDrag.Started += drag_Started;
			downDrag.Changed += drag_Changed;			
			downDrag.Completed += drag_Completed;

			Print();
		}
Esempio n. 8
0
		void drag_Completed(DragListener drag)
		{
			IsDragging = false;
			OnDragCompleted();
		}
Esempio n. 9
0
		void drag_Changed(DragListener drag)
		{
			IsDragging = true;
			MoveValue(-drag.DeltaDelta.Y * SmallChange);
		}
Esempio n. 10
0
		void drag_Started(DragListener drag)
		{
			OnDragStarted();
		}
Esempio n. 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            upButton = (DragRepeatButton)Template.FindName("PART_UpButton", this);
            downButton = (DragRepeatButton)Template.FindName("PART_DownButton", this);
            textBox = (TextBox)Template.FindName("PART_TextBox", this);

            upButton.Click += upButton_Click;
            downButton.Click += downButton_Click;

            textBox.LostFocus += (sender, e) => OnLostFocus(e);

            var upDrag = new DragListener(upButton);
            var downDrag = new DragListener(downButton);

            upDrag.Started += drag_Started;
            upDrag.Changed += drag_Changed;
            upDrag.Completed += drag_Completed;

            downDrag.Started += drag_Started;
            downDrag.Changed += drag_Changed;
            downDrag.Completed += drag_Completed;

            Print();
        }
Esempio n. 12
0
 void drag_Completed(DragListener drag)
 {
     IsDragging = false;
     OnDragCompleted();
 }
Esempio n. 13
0
 void drag_Changed(DragListener drag)
 {
     IsDragging = true;
     MoveValue(-drag.DeltaDelta.Y * SmallChange);
 }
Esempio n. 14
0
 void drag_Started(DragListener drag)
 {
     OnDragStarted();
 }