Drag Drop on a Canvas

Jun 16, 2008 at 8:35 AM


I am trying to test a drag drop in WPF, of a button on a canvas.

UIItem canvas = window.Get<UIItem>(SearchCriteria.ByControlType(ControlType.???));

<UIItem>Mouse.Instance.DragAndDrop(window.Get<Button>(SearchCriteria.ByAutomationId("Description")), canvas);

<UIItem>Can anyone help?



Jun 16, 2008 at 8:55 AM
You can try UISpy to find out the control type of your Canvas.
Jun 17, 2008 at 10:44 AM


UISpy doesn't see Canvas. However my Canvas is in a Tab, so I did:

  UIItem canvas =

Button draggedItem = window.Get<Button>(SearchCriteria.ByAutomationId("Description"));

which does the drag, then moves the mouse in the middle of the Tab and waits (I waited for 30 seconds). Just when I move the mouse I see the control dropped properly. 

Can you help,



Jul 2, 2008 at 7:32 PM
Did you try playing with DragStepCount to see whether that makes a difference. Look at the configuration section on the website.