IRawElementProviderSimple.GetPropertyValue(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 使用者介面自動化 提供者所支援屬性的值。
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
屬性識別碼。
傳回
財產價值,或 a 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 。