AutomationElement.AccessKeyProperty Pole

Definicja

Identyfikuje AccessKey właściwość .

public: static initonly System::Windows::Automation::AutomationProperty ^ AccessKeyProperty;
public static readonly System.Windows.Automation.AutomationProperty AccessKeyProperty;
 staticval mutable AccessKeyProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly AccessKeyProperty 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 nie podaje go.

string accessKey =
    autoElement.GetCurrentPropertyValue(AutomationElement.AccessKeyProperty) as string;
Dim accessKey As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.AccessKeyProperty))

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 należy zwrócić zamiast wartości domyślnej.

string accessKeyString;
object accessKeyNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.AccessKeyProperty, true);
if (accessKeyNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    accessKeyString = accessKeyNoDefault as string;
}
Dim accessKeyString As String
Dim accessKeyNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.AccessKeyProperty, True)
If accessKeyNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    accessKeyString = CStr(accessKeyNoDefault)
End If

Uwagi

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

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

Klucz dostępu jest znakiem w tekście menu, elementu menu lub etykiety kontrolki, takiej jak przycisk, który aktywuje dołączoną funkcję menu. Na przykład litera "O" jest często używana do wywoływania typowego okna dialogowego Otwieranie pliku z menu Plik .

Wartości klucza dostępu są typu String i zawierają znak zarejestrowany jako klucz dostępu dla elementu. Wartość domyślna ciągu to pusty ciąg.

Dotyczy

Zobacz też