Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UITestControl::SearchProperties Property

 

Gets the property-value pair collection that is used to identify a control.

Namespace:   Microsoft.VisualStudio.TestTools.UITesting
Assembly:  Microsoft.VisualStudio.TestTools.UITesting (in Microsoft.VisualStudio.TestTools.UITesting.dll)

public:
property PropertyExpressionCollection^ SearchProperties {
	PropertyExpressionCollection^ get();
}

Property Value

Type: Microsoft.VisualStudio.TestTools.UITesting::PropertyExpressionCollection^

The property-value pair collection that is used to identify a control.

Legacy Code Example

WinButton saveButton = new WinButton(window);
saveButton.SearchProperties.Add(WinProperties.Button.Name, “btnSave”);

If you want to use Contains operator

WinButton saveButton = new WinButton(window);
//If the name of the button contains “Save”, then it will be found.
saveButton.SearchProperties.Add(WinProperties.Button.Name, “Save”, PropertyExpressionOperator. Contains);

The generated code will resemble the following:

Public WinButton BtnSaveButton
{
   get
   {
      if ((this.mBtnSaveButton == null))
         {
            this.mBtnSaveButton = new WinButton(this);
#region Search Criteria
            this.mBtnSaveButton.SearchProperties[WinProperties.Button.Name] = "btnSave";
#endregion
         }
return this.mBtnSaveButton;
   }
}

Return to top
Show: