AutomationElement.IsEnabledProperty 欄位

定義

識別 IsEnabled 屬性,指出是否啟用 AutomationElement 所參考的 使用者介面 (UI)user interface (UI) 項目。Identifies the IsEnabled property, which specifies whether the 使用者介面 (UI)user interface (UI) item referenced by the AutomationElement is enabled.

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

欄位值

範例

下列範例會抓取屬性的目前值。The following example retrieves the current value of the property. 如果專案未提供預設值,則會傳回預設值。The default value is returned if the element does not provide one.

bool isControlEnabled = (bool)
   autoElement.GetCurrentPropertyValue(AutomationElement.IsEnabledProperty);
Dim isControlEnabled As Boolean = _
    CBool(autoElement.GetCurrentPropertyValue(AutomationElement.IsEnabledProperty))

備註

這個識別碼是由使用者介面自動化用戶端應用程式所使用。This identifier is used by UI Automation client applications. 使用者介面自動化提供者應該在中AutomationElementIdentifiers使用對等的識別碼。UI Automation providers should use the equivalent identifier in AutomationElementIdentifiers.

這個屬性也可以從CurrentCached屬性抓取。This property can also be retrieved from the Current or Cached properties.

屬性的傳回值為類型BooleanReturn values of the property are of type Boolean. 屬性的預設值為falseThe default value for the property is false.

當控制項的啟用狀態為false時,會假設子控制項也未啟用。When the enabled state of a control is false, it is assumed that child controls are also not enabled. 當父控制項的狀態變更時,您應該不會預期子項目的屬性變更事件。You should not expect property-changed events from child elements when the state of the parent control changes.

適用於

另請參閱