IRawElementProviderSimple.GetPropertyValue(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the value of a property supported by the UI Automation provider.
public:
System::Object ^ GetPropertyValue(int propertyId);
public object GetPropertyValue (int propertyId);
abstract member GetPropertyValue : int -> obj
Public Function GetPropertyValue (propertyId As Integer) As Object
Parameters
- propertyId
- Int32
The property identifier.
Returns
The property value, or a null
if the property is not supported by this provider, or NotSupported if it is not supported at all.
Examples
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;
}
}
Function GetPropertyValue(ByVal propertyId As Integer) As Object _
Implements IRawElementProviderSimple.GetPropertyValue
If propertyId = AutomationElementIdentifiers.NameProperty.Id Then
Return "RootButtonControl"
ElseIf propertyId = AutomationElementIdentifiers.ClassNameProperty.Id Then
Return "RootButtonControlClass"
ElseIf propertyId = AutomationElementIdentifiers.ControlTypeProperty.Id Then
Return ControlType.Button.Id
ElseIf propertyId = AutomationElementIdentifiers.IsContentElementProperty.Id Then
Return False
ElseIf propertyId = AutomationElementIdentifiers.IsControlElementProperty.Id Then
Return True
Else
Return Nothing
End If
End Function 'IRawElementProviderSimple.GetPropertyValue
Remarks
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.
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om