How to TypeCast a CUITe control to a UITestControl

Dec 18, 2013 at 6:23 PM
Hi,

My HTML5 application has a few components that require to be dragged and dropped.

I tried to use Mouse.StartDragging(UITestControl Control, Point relativeCoordinate, System.Windows.Form.MouseButtons button, System.Windows.Input.ModifierKeys modifierKeys);

As stated above this function needs a UITestControl as a parameter and would not accept a CUITe control. On trying to typecast a CUITe control as a UITestControl I get the error that a CUITe control cannot be converted to a UITestControl.

Any help in this regard will be much appreciated.

Regards,
Ankit Saxena
Dec 19, 2013 at 2:27 PM
Ankit,

You can use the UnWrap() method to create a UITestControl. We implemented Drag and Drop on a couple or our applications. Here is the code we used to convert a CUITe_HTMLDIV to a HtmlDiv:

HtmlDiv CUIDiv = (HtmlDiv)handleDiv.UnWrap();

Good Luck.

Jeff
Marked as answer by saxenaankit123 on 12/20/2013 at 9:19 AM
Dec 20, 2013 at 5:18 PM
Thanks Jeff that helps.

I have been able to use the desired function as follows now:

Mouse.StartDragging(CUITeControl.Unwrap(), Point relativeCoordinate, System.Windows.Form.MouseButtons button, System.Windows.Input.ModifierKeys modifierKeys);

Regards,
Ankit