This documentation is archived and is not being maintained.

IRawElementProviderSimple.GetPropertyValue Method

Retrieves the value of a property supported by the UI Automation provider.

Namespace:  System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

Object GetPropertyValue(
	int propertyId


Type: System.Int32

The property identifier.

Return Value

Type: System.Object
The property value, or a null if the property is not supported by this provider, or NotSupported if it is not supported at all.

A provider should return NotSupported only if it is explicitly hiding the property value and the request is not to be passed through to other providers.

The following code example shows an implementation of GetPropertyValue for a custom button control.

object IRawElementProviderSimple.GetPropertyValue(int propertyId)
    if (propertyId == AutomationElementIdentifiers.NameProperty.Id)
        return "RootButtonControl";
    else if (propertyId == AutomationElementIdentifiers.ClassNameProperty.Id)
        return "RootButtonControlClass";
    else if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id)
        return ControlType.Button.Id;  
    else if (propertyId == AutomationElementIdentifiers.IsContentElementProperty.Id)
        return false;
    else if (propertyId == AutomationElementIdentifiers.IsControlElementProperty.Id)
        return true;
        return null;

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0