AutomationElement.IsEnabledProperty 欄位

定義

識別 IsEnabled 屬性,指出是否啟用 使用者介面 (UI)user interface (UI) 所參考的 AutomationElement 項目。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 

欄位值

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. 消費者介面自動化提供者應該在中使用對等的識別碼 AutomationElementIdentifiersUI Automation providers should use the equivalent identifier in AutomationElementIdentifiers.

這個屬性也可以從 Current 或屬性中抓取 CachedThis 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.

適用於

另請參閱