This project is read-only.

Subclassed Windows Form Controls

Apr 18, 2008 at 2:23 PM
For some reason, subclassed form controls (e.g. MyTextBox : System.Windows.Forms.TextBox) are not found by the
Window.Get<T>(...) method.

If a form contains a MyTextBox control named 'myTextBox1', for example, then the Get method with 'myTextBox1' as parameter string returns null. This doesn't happen with the regular controls and with custom controls.

When I enumarate over all controls (using the FindAll() method of the AutomationElement for the main application window), it seems that the derived form controls (MyTextBox) have some numeric AutomationId, but for the regular windows control the AutomationId is equal to the name of the control.

Does anyone know what the problem is?
Apr 18, 2008 at 6:11 PM
As far as I know there is no such issue with AutomationId in WinForms. I tried it and it works fine.
If you can send me some sample code or failing test maybe then I can help you further.