IRawElementProviderSimple.GetPropertyValue Method (Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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;

.NET Framework
Available since 3.0
Return to top