IRawElementProviderSimple.GetPropertyValue(Int32) Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Recupera il valore di una proprietà supportata dal provider di automazione interfaccia utente.
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
Identificatore della proprietà.
Valore della proprietà o null
se la proprietà non è supportata dal provider oppure NotSupported se non è mai supportata.
Nell'esempio di codice seguente viene illustrata un'implementazione di GetPropertyValue per un controllo pulsante personalizzato.
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
Un provider deve restituire NotSupported solo se nasconde in modo esplicito il valore della proprietà e la richiesta non deve essere passata ad altri provider.
Prodotto | Versioni |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: