Export (0) Print
Expand All

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
)

Parameters

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;
    }
    else
    {
        return null;
    }
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft