Share via


AutomationElement.ControlTypeProperty Bidang

Definisi

ControlType Mengidentifikasi properti .

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

Nilai Bidang

Contoh

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

ControlType controlTypeId = 
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty)
    as ControlType;
Dim controlTypeId As ControlType = _
  DirectCast(autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty), ControlType)

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.

ControlType controlTypeId1;
object controlTypeNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, true);
if (controlTypeNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else  
{
    controlTypeId1 = controlTypeNoDefault as ControlType;
}
Dim controlTypeId1 As ControlType
Dim controlTypeNoDefault As Object = _
    autoElement.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, True)
If controlTypeNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    controlTypeId1 = DirectCast(controlTypeNoDefault, ControlType)
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 .

Nilai default untuk properti adalah Custom

Berlaku untuk

Lihat juga