Share via


AutomationElement.ClassNameProperty Campo

Definizione

Identifica la proprietà ClassName.

public: static initonly System::Windows::Automation::AutomationProperty ^ ClassNameProperty;
public static readonly System.Windows.Automation.AutomationProperty ClassNameProperty;
 staticval mutable ClassNameProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ClassNameProperty 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 className =
    autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty) as string;
Dim className As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty)

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à , NotSupported deve essere restituito anziché un valore predefinito.

string classNameString;
object classNameNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty, true);
if (classNameNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    classNameString = classNameNoDefault as string;
}
Dim classNameString As String
Dim classNameNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClassNameProperty, True)
If classNameNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    classNameString = CStr(classNameNoDefault)
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 nome della classe dipende dall'implementazione del provider Automazione interfaccia utente e pertanto non può essere conteggiato in un formato standard. Tuttavia, se si conosce il nome della classe, è possibile usarlo per verificare che l'applicazione funzioni con l'elemento Automazione interfaccia utente previsto.

I valori restituiti della proprietà sono di tipo String. Il valore predefinito è una stringa vuota.

Si applica a

Vedi anche