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.SetProperty Method (String, Object)


Sets the value of a given property.

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

public virtual void SetProperty(
	string propertyName,
	object value


Type: System.String

The property name.

Type: System.Object

The value to be set.

To access the properties of a UITestControl, for example to get the count of items in a list, or to set the text on a button, you must use GetProperty and SetProperty to get and set the specific properties of the UITestControl. The propertyName parameter specifies the property to access.

To change the text on a WinButton, use SetProperty together with the parameter DisplayText, followed by the new text for the button.

Return to top