AutomationElement.NameProperty Pole

Definicja

Identyfikuje Name właściwość .

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

Wartość pola

Przykłady

Poniższy przykład pobiera bieżącą wartość właściwości . Wartość domyślna jest zwracana, jeśli element go nie podaje.

string nameProp =
    autoElement.GetCurrentPropertyValue(AutomationElement.NameProperty) as string;
Dim nameProp As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.NameProperty))

Poniższy przykład pobiera bieżącą wartość właściwości, ale określa, że jeśli sam element nie podaje wartości właściwości, NotSupported ma zostać zwrócony zamiast wartości domyślnej.

string nameProp1;
object namePropNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.NameProperty, true);
if (namePropNoDefault == AutomationElement.NotSupported)
{
    nameProp1 = "No name.";
}
else
{
    nameProp1 = namePropNoDefault as string;
}
Dim nameProp1 As String
Dim namePropNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.NameProperty, True)
If namePropNoDefault Is AutomationElement.NotSupported Then
    nameProp1 = "No name."
Else
    nameProp1 = CStr(namePropNoDefault)
End If

Uwagi

Ten identyfikator jest używany przez aplikacje klienckie automatyzacja interfejsu użytkownika. automatyzacja interfejsu użytkownika dostawcy powinni używać równoważnego identyfikatora w elemencie AutomationElementIdentifiers.

Tę właściwość można również pobrać z Current właściwości lub Cached .

Zwracane wartości właściwości są typu String. Wartość domyślna właściwości to pusty ciąg.

Dotyczy

Zobacz też