AutomationElement.ItemTypeProperty Campo

Definizione

Identifica la proprietà ItemType.

public: static initonly System::Windows::Automation::AutomationProperty ^ ItemTypeProperty;
public static readonly System.Windows.Automation.AutomationProperty ItemTypeProperty;
 staticval mutable ItemTypeProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ItemTypeProperty As AutomationProperty 

Valore del campo

Esempio

Nell'esempio seguente viene recuperato il valore corrente della proprietà . Il valore predefinito viene restituito se l'elemento non ne fornisce uno.

string itemType =
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty) as string;
Dim itemType As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty))

Nell'esempio seguente viene recuperato il valore corrente della proprietà , ma viene specificato che se l'elemento stesso non fornisce un valore per la proprietà , deve essere restituita una stringa definita dall'applicazione anziché un valore predefinito.

string itemType1;
object itemTypeNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty, true);
if (itemTypeNoDefault == AutomationElement.NotSupported)
{
    itemType1 = "Unknown type";
}
else
{
    itemType1 = itemStatusNoDefault as string;
}
Dim itemType1 As String
Dim itemTypeNoDefault As Object = _
    autoElement.GetCurrentPropertyValue(AutomationElement.ItemTypeProperty, True)
If itemTypeNoDefault Is AutomationElement.NotSupported Then
    itemType1 = "Unknown type"
Else
    itemType1 = CStr(itemStatusNoDefault)
End If

Commenti

Questo identificatore viene usato da Automazione interfaccia utente applicazioni client. Automazione interfaccia utente provider devono usare l'identificatore equivalente in AutomationElementIdentifiers.

Questa proprietà può essere recuperata anche dalle Current proprietà o Cached .

Il valore restituito è un oggetto definito dal Stringcontrollo . Il valore predefinito è una stringa vuota.

Si applica a

Vedi anche