Hi,
The Button is a simple Framework control.
The IntegerUpDown is a more complex control, made of a ButtonSpinner containing a WatermarkTextBox .
In the ControlTemplate of the IntegerUpDown, the ButtonSpinner is named "PART_Spinner", while the WatermarkTextBox is named "PART_TextBox".
In the ControlTemplate of the ButtonSpinner, there is a ContentPresenter (named "contentPresenter") and 2 RepeatButtons (named "PART_IncreaseButton" and "PART_DecreaseButton").
In code, the WatermarkTextBox derives from AutoSelectTextBox.
The static constructor of AutoSelectTextBox overrides the AutomationIdProperty to set it to "AutoSelectTextBox".
So for 3 IntegerUpDowns, Code UI Test will generate something like :
If you remove the static constructor from AutoSelectTextBox, Code UI Test will generate something like :
So you probably set the InterUpDown's AutomationID, but the it's the WatermarkTextBox and the RepeatButtons from IntegerUpDown that are clickables.
The Button is a simple Framework control.
The IntegerUpDown is a more complex control, made of a ButtonSpinner containing a WatermarkTextBox .
In the ControlTemplate of the IntegerUpDown, the ButtonSpinner is named "PART_Spinner", while the WatermarkTextBox is named "PART_TextBox".
In the ControlTemplate of the ButtonSpinner, there is a ContentPresenter (named "contentPresenter") and 2 RepeatButtons (named "PART_IncreaseButton" and "PART_DecreaseButton").
In code, the WatermarkTextBox derives from AutoSelectTextBox.
The static constructor of AutoSelectTextBox overrides the AutomationIdProperty to set it to "AutoSelectTextBox".
So for 3 IntegerUpDowns, Code UI Test will generate something like :
this.mUIAutoSelectTextBoxEdit.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "AutoSelectTextBox";
this.mUIAutoSelectTextBoxEdit.WindowTitles.Add("MainWindow");
this.mUIAutoSelectTextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "AutoSelectTextBox";
this.mUIAutoSelectTextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.Instance] = "2";
this.mUIAutoSelectTextBoxEdit1.WindowTitles.Add("MainWindow");
this.mUIAutoSelectTextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "AutoSelectTextBox";
this.mUIAutoSelectTextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.Instance] = "3";
this.mUIAutoSelectTextBoxEdit1.WindowTitles.Add("MainWindow");
where each WatermarkTextBox (from 3 different IntegerUpDowns) have the AutomationId "AutoSelectTextBox", but with different instances !!If you remove the static constructor from AutoSelectTextBox, Code UI Test will generate something like :
this.mUIPART_TextBoxEdit.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "PART_TextBox";
this.mUIPART_TextBoxEdit.WindowTitles.Add("MainWindow");
this.mUIPART_TextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "PART_TextBox";
this.mUIPART_TextBoxEdit1.SearchProperties[WpfEdit.PropertyNames.Instance] = "2";
this.mUIPART_TextBoxEdit1.WindowTitles.Add("MainWindow");
this.mUIPART_TextBoxEdit2.SearchProperties[WpfEdit.PropertyNames.AutomationId] = "PART_TextBox";
this.mUIPART_TextBoxEdit2.SearchProperties[WpfEdit.PropertyNames.Instance] = "3";
this.mUIPART_TextBoxEdit2.WindowTitles.Add("MainWindow");
where each WatermarkTextBox (from 3 different IntegerUpDowns) have the AutomationId "PART_TextBox", but with different instances !!So you probably set the InterUpDown's AutomationID, but the it's the WatermarkTextBox and the RepeatButtons from IntegerUpDown that are clickables.