IRawElementProviderSimple.GetPropertyValue(Int32) Metoda

Definicja

Pobiera wartość właściwości obsługiwanej przez dostawcę automatyzacja interfejsu użytkownika.

public:
 System::Object ^ GetPropertyValue(int propertyId);
public object GetPropertyValue (int propertyId);
abstract member GetPropertyValue : int -> obj
Public Function GetPropertyValue (propertyId As Integer) As Object

Parametry

propertyId
Int32

Identyfikator właściwości.

Zwraca

Wartość właściwości lub null jeśli właściwość nie jest obsługiwana przez tego dostawcę lub NotSupported jeśli w ogóle nie jest obsługiwana.

Przykłady

Poniższy przykład kodu przedstawia implementację kontrolki GetPropertyValue przycisku niestandardowego.

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

Uwagi

Dostawca powinien zwrócić tylko NotSupported wtedy, gdy jawnie ukrywa wartość właściwości, a żądanie nie jest przekazywane do innych dostawców.

Dotyczy

Zobacz też