IRawElementProviderSimple.GetPropertyValue(Int32) メソッド

定義

UI オートメーション プロバイダーでサポートされるプロパティの値を取得します。

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

パラメーター

propertyId
Int32

プロパティの識別子。

戻り値

プロパティの値か、null か (このプロバイダーでプロパティがサポートされていない場合)、NotSupported (まったくサポートされていない場合)。

次のコード例は、カスタム ボタン コントロールの の GetPropertyValue 実装を示しています。

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

注釈

プロバイダーは、プロパティ値を明示的に非表示にしていて、要求が他のプロバイダーに渡されない場合にのみを返 NotSupported す必要があります。

適用対象

こちらもご覧ください