protected override void OnQueryContinueDrag(QueryContinueDragEventArgs e)
        {
            base.OnQueryContinueDrag(e);

            e.Action = DragAction.Cancel;
            e.Handled = true;
        }
Example #2
0
 private static void triggerElement_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     e.Action = DragAction.Drop;
     if ((e.KeyStates & DragDropKeyStates.LeftMouseButton) != DragDropKeyStates.None)
         e.Action = DragAction.Continue;
     if (e.Action == DragAction.Drop)
         _contentPresenter = null;
 }
Example #3
0
        protected override void OnPreviewQueryContinueDrag(QueryContinueDragEventArgs args)
        {
            base.OnPreviewQueryContinueDrag(args);

            if (args.Action == DragAction.Cancel || args.Action == DragAction.Drop) {
                CancelDrag();
            } else if (args.Action == DragAction.Continue) {
                Point p = MouseUtilities.GetMousePosition(this);
                if ((p.Y < DRAG_MARGIN) || (p.Y > RenderSize.Height - DRAG_MARGIN)) {
                    if (_dragScrollTimer == null) {
                        _dragVelocity = DRAG_INITIAL_VELOCITY;
                        _dragScrollTimer = new DispatcherTimer();
                        _dragScrollTimer.Tick += TickDragScroll;
                        _dragScrollTimer.Interval = new TimeSpan(0, 0, 0, 0, (int)DRAG_INTERVAL);
                        _dragScrollTimer.Start();
                    }
                }
            }
        }
Example #4
0
        protected override void OnPreviewQueryContinueDrag(QueryContinueDragEventArgs args)
        {
            base.OnPreviewQueryContinueDrag(args);

            if (args.Action == DragAction.Cancel || args.Action == DragAction.Drop)
            {
                CancelDrag();
            }
            else if (args.Action == DragAction.Continue)
            {
                Point p = MouseUtilities.GetMousePosition(this);
                if ((p.Y < s_dragMargin) || (p.Y > RenderSize.Height - s_dragMargin))
                {
                    if (_dragScrollTimer == null)
                    {
                        _dragVelocity = s_dragInitialVelocity;
                        _dragScrollTimer = new DispatcherTimer();
                        _dragScrollTimer.Tick += TickDragScroll;
                        _dragScrollTimer.Interval = new TimeSpan(0, 0, 0, 0, (int)s_dragInterval);
                        _dragScrollTimer.Start();
                    }
                }
            }
        }
Example #5
0
 private void mediaElement1_QueryContinueDrag(object sender, System.Windows.QueryContinueDragEventArgs e)
 {
     // TimerSlider.Value = mediaElement1.Position.Milliseconds;
 }
Example #6
0
 public static void DefaultQueryContinueDrag(QueryContinueDragEventArgs e)
 {
     if (!e.EscapePressed)
         return;
     e.Action = DragAction.Cancel;
     e.Handled = true;
 }
 private void ListViewPages_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
   if(e.EscapePressed)
   {
     e.Action = DragAction.Cancel;
   }
 }
 /// <summary>
 ///     Virtual method reporting the preview query continue drag is going to happen
 /// </summary>
 protected virtual void OnPreviewQueryContinueDrag(QueryContinueDragEventArgs e) {}
 private static void DragSource_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if (e.Action == DragAction.Cancel || e.EscapePressed) {
     DragAdorner = null;
     EffectAdorner = null;
     DropTargetAdorner = null;
       }
 }
Example #10
0
		void IMouseProcessor.PostprocessQueryContinueDrag(QueryContinueDragEventArgs e) { }
Example #11
0
 private void listBoxItem_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if (dragGhost != null)
     {
         var p = CursorInfo.GetNowPosition(this);
         var loc = this.PointFromScreen(this.PointToScreen(new Point(0, 0)));
         dragGhost.LeftOffset = p.X - loc.X;
         dragGhost.TopOffset = p.Y - loc.Y;
     }
 }
Example #12
0
        /// <summary>
        /// Default query continue drag during drag-and-drop operation.
        /// </summary>
        /// <remarks>
        ///     At this stage we do not know application's intended mouse
        ///     button combination for dragging. For default purposes we assume
        ///     that the DragDrop happens due to single mouse button press.
        ///     Hence if any two mouse buttons are pressed at any point of time,
        ///     then we cancel the drapdrop. Also if no mouse buttons are pressed at
        ///     any point of time, then we complete the drop. If an application intends
        ///     to privide multi-button press dragging (like dragging by pressing 
        ///     both left and right buttons of mouse) applications will have
        ///     to handle (Preview)QueryContiueDragEvent to the allow 
        ///     such valid combinations explicitly.
        /// </remarks>
        private void OnDefaultQueryContinueDrag(QueryContinueDragEventArgs e)
        {
            int mouseButtonDownCount = 0;
            
            if ((e.KeyStates & DragDropKeyStates.LeftMouseButton) == DragDropKeyStates.LeftMouseButton)
            {
                mouseButtonDownCount++;
            }
            if ((e.KeyStates & DragDropKeyStates.MiddleMouseButton) == DragDropKeyStates.MiddleMouseButton)
            {
                mouseButtonDownCount++;
            }
            if ((e.KeyStates & DragDropKeyStates.RightMouseButton) == DragDropKeyStates.RightMouseButton)
            {
                mouseButtonDownCount++;
            }

            e.Action = DragAction.Continue;

            if (e.EscapePressed ||
                mouseButtonDownCount >= 2)
            {
                e.Action = DragAction.Cancel;
            }
            else if (mouseButtonDownCount == 0)
            {
                e.Action = DragAction.Drop;
            }
        }
Example #13
0
        /// <summary>
        /// Raise QueryContinueDrag event for Tunel and Bubble.
        /// </summary>
        private void RaiseQueryContinueDragEvent(QueryContinueDragEventArgs args)
        {
            // Set PreviewQueryContinueDrag(Tunnel) first.
            args.RoutedEvent=DragDrop.PreviewQueryContinueDragEvent;

            // Raise the preview QueryContinueDrag event(Tunnel).
            if (_dragSource is UIElement)
            {
                ((UIElement)_dragSource).RaiseEvent(args);
            }
            else if (_dragSource is ContentElement)
            {
                ((ContentElement)_dragSource).RaiseEvent(args);
            }
            else if (_dragSource is UIElement3D)
            {
                ((UIElement3D)_dragSource).RaiseEvent(args);
            }
            else
            {
                throw new ArgumentException(SR.Get(SRID.ScopeMustBeUIElementOrContent), "scope");
            }

            // Set QueryContinueDrag(Bubble).
            args.RoutedEvent = DragDrop.QueryContinueDragEvent;

            // Raise QueryContinueDrag event(Bubble).
            if (!args.Handled)
            {
                if (_dragSource is UIElement)
                {
                    ((UIElement)_dragSource).RaiseEvent(args);
                }
                else if (_dragSource is ContentElement)
                {
                    ((ContentElement)_dragSource).RaiseEvent(args);
                }
                else if (_dragSource is UIElement3D)
                {
                    ((UIElement3D)_dragSource).RaiseEvent(args);
                }
                else
                {
                    throw new ArgumentException(SR.Get(SRID.ScopeMustBeUIElementOrContent), "scope");
                }
            }

            // Call the default event handling method internally if no one handle the drag source events.
            if (!args.Handled)
            {
                OnDefaultQueryContinueDrag(args);
            }
        }
 public void ContinueDrag(System.Windows.QueryContinueDragEventArgs args)
 {
     throw new NotImplementedException("Forgot to check the Supported actions??");
 }
Example #15
0
 protected internal virtual new void OnQueryContinueDrag(QueryContinueDragEventArgs e)
 {
 }
		void textArea_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
		{
			try {
				if (e.EscapePressed) {
					e.Action = DragAction.Cancel;
				} else if ((e.KeyStates & DragDropKeyStates.LeftMouseButton) != DragDropKeyStates.LeftMouseButton) {
					e.Action = DragAction.Drop;
				} else {
					e.Action = DragAction.Continue;
				}
				e.Handled = true;
			} catch (Exception ex) {
				OnDragException(ex);
			}
		}
Example #17
0
 protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e)
 {
     throw new NotImplementedException();
 }
Example #18
0
        private void PictureToAssign_OnQueryContinueDrag (object Sender, QueryContinueDragEventArgs E)
		    {
		    if (E.Action != DragAction.Continue)
			    {
			    DragStartPosition = new Point (0, 0);
			    IsDragging = false;
			    }
		    }
Example #19
0
 void OnQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if ((e.KeyStates & DragDropKeyStates.LeftMouseButton) != DragDropKeyStates.LeftMouseButton)
     {
         e.Action = DragAction.Cancel;
     }
 }
Example #20
0
 private void DragScopeQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if (!_dragHasLeftScope) return;
     e.Action = DragAction.Cancel;
     e.Handled = true;
 }
		void MouseElement_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) {
			foreach (var m in mouseProcessors) {
				if (e.Handled)
					break;
				m.PreprocessQueryContinueDrag(e);
			}
			if (!e.Handled)
				defaultMouseProcessor.OnQueryContinueDrag(sender, e);
			foreach (var m in mouseProcessors)
				m.PostprocessQueryContinueDrag(e);
		}
Example #22
0
 private void DragSourceQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     UpdateWindowLocation();
 }
Example #23
0
        private static void OnQueryContinueDragThunk(object sender, QueryContinueDragEventArgs e)
        {
            Invariant.Assert(!e.Handled, "Unexpected: Event has already been handled.");

            UIElement uie = sender as UIElement;

            if (uie != null)
            {
                uie.OnQueryContinueDrag(e);
            }
            else
            {
                ContentElement ce = sender as ContentElement;

                if (ce != null)
                {
                    ce.OnQueryContinueDrag(e);
                }
                else
                {
                    ((UIElement3D)sender).OnQueryContinueDrag(e);
                }
            }
        }
Example #24
0
 public void PreprocessQueryContinueDrag(QueryContinueDragEventArgs e) {
     IMouseProcessor processor = Content as IMouseProcessor;
     if (processor != null) {
         processor.PreprocessQueryContinueDrag(e);
     }
 }
 /// <summary>
 ///     Virtual method reporting the query continue drag is going to happen
 /// </summary>
 protected internal virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e) {}
Example #26
0
		protected virtual void OnQueryContinueDrag (QueryContinueDragEventArgs e)
		{
			throw new NotImplementedException ();
		}
Example #27
0
 void DragScope_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if (this._dragHasLeftScope)
     {
         e.Action = DragAction.Cancel;
         e.Handled = true;
     }
 }
 protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e);
Example #29
0
 public static void DefaultQueryContinueDragHandler(object sender, QueryContinueDragEventArgs e)
 {
     DataObjectExtensions.DefaultQueryContinueDrag(e);
 }
Example #30
0
 /// <summary>
 /// Called when the preview query continue drag is called.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="QueryContinueDragEventArgs"/> instance containing the event data.</param>
 private static void OnPreviewQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
 {
     if ((e.EscapePressed ||
         ((e.KeyStates & DragDropKeyStates.LeftMouseButton) != DragDropKeyStates.LeftMouseButton)) &&
         (popup != null))
     {
         popup.IsOpen = false;
         popup = null;
     }
 }
 void IMouseProcessor.PreprocessQueryContinueDrag(QueryContinueDragEventArgs e)
 {
     if (_mouseProcessor != null)
     {
         _mouseProcessor.PreprocessQueryContinueDrag(e);
     }
 }
Example #32
0
        private void PreviewQueryContinueDragCallback( object sender, QueryContinueDragEventArgs e )
        {
            if( m_maskIsNull )
            return;

              e.Action = DragAction.Cancel;
              e.Handled = true;
        }
Example #33
0
        /// <summary>
        /// Gather keyboard key state information
        /// and optionally abort a drag operation
        /// </summary>
        private void DragSource_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) {

            if((this._dragDropObject.DataProviderActions & DataProviderActions.QueryContinueDrag) != 0)
                this._dragDropObject.DragSource_QueryContinueDrag(sender, e);
        }
Example #34
0
        /// <summary>
        /// An event reporting that the query continue drag during drag-and-drop operation.
        /// </summary>
        internal static void OnQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
        {
            TextEditor This = TextEditor._GetTextEditor(sender);

            if (This == null)
            {
                return;
            }

            // Ignore the event if the editor has been detached from its scope
            if (!This._IsEnabled)
            {
                return;
            }

            // Consider event handled
            e.Handled = true;

            e.Action = DragAction.Continue;
            bool mouseUp = (((int)e.KeyStates & (int)DragDropKeyStates.LeftMouseButton) == 0);
            if (e.EscapePressed)
            {
                e.Action = DragAction.Cancel;
            }
            else if (mouseUp)
            {
                e.Action = DragAction.Drop;
            }
        }