AutomationElement.IsControlElementProperty 欄位

定義

識別 IsControlElement 屬性。

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

欄位值

範例

下列範例會擷取 屬性的目前值。 如果專案未提供預設值,則會傳回預設值。

bool isControl = (bool)
   autoElement.GetCurrentPropertyValue(AutomationElement.IsControlElementProperty);
Dim isControl As Boolean = CBool(autoElement.GetCurrentPropertyValue(AutomationElement.IsControlElementProperty))

下列範例會擷取屬性的目前值,但指定如果專案本身未提供屬性的值, NotSupported 則會傳回 而不是預設值。

bool isControl1;
object isControlNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.IsControlElementProperty, true);
if (isControlNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    isControl1 = (bool)isControlNoDefault;
}
Dim isControl1 As Boolean
Dim isControlNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.IsControlElementProperty, True)
If isControlNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    isControl1 = CBool(isControlNoDefault)
End If

備註

使用者介面自動化用戶端應用程式會使用此識別碼。 使用者介面自動化提供者應該使用 中的 AutomationElementIdentifiers 對等識別碼。

您也可以從 CurrentCached 屬性擷取這個屬性。

控制項是使用者認為為互動式或包含 UI 中資訊的元素。

屬性的傳回值的類型為 Boolean 。 屬性的預設值為 true

適用於

另請參閱