Share via


AutomationElement.AcceleratorKeyProperty Bidang

Definisi

AcceleratorKey Mengidentifikasi properti .

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

Nilai Bidang

Contoh

Contoh berikut mengambil nilai properti saat ini. Nilai default dikembalikan jika elemen tidak menyediakannya.

string acceleratorKey = 
    autoElement.GetCurrentPropertyValue(AutomationElement.AcceleratorKeyProperty) as string;
Dim acceleratorKey As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.AcceleratorKeyProperty))

Contoh berikut mengambil nilai properti saat ini, tetapi menentukan bahwa jika elemen itu sendiri tidak memberikan nilai untuk properti , NotSupported akan dikembalikan alih-alih nilai default.

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

Keterangan

Pengidentifikasi ini digunakan oleh aplikasi klien Automation UI. Penyedia Automation UI harus menggunakan pengidentifikasi yang setara di AutomationElementIdentifiers.

Properti ini juga dapat diambil dari Current properti atau Cached .

Kombinasi kunci akselerator memanggil tindakan. Misalnya, CTRL+O sering digunakan untuk memanggil kotak dialog Buka file umum. Yang AutomationElement memiliki set properti kunci akselerator selalu mengimplementasikan InvokePattern kelas .

Nilai yang dikembalikan dari properti berjenis String. Nilai default untuk properti adalah string kosong.

Berlaku untuk

Lihat juga