Drag Drop on a Canvas

Jun 16, 2008 at 8:35 AM

Hi,

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?

<UIItem>Thanks,

<UIItem>Dan

Coordinator
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

Ok,

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

  UIItem canvas =
(UIItem)window.Get(SearchCriteria.ByControlType(ControlType.Tab));

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

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,

Thanks,

Dan

Coordinator
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.