ContentElement.IsEnabled ContentElement.IsEnabled ContentElement.IsEnabled ContentElement.IsEnabled Property

定義

取得或設定值,這個值表示這個項目是否已在 使用者介面 (UI)user interface (UI) 中啟用。Gets or sets a value that indicates whether this element is enabled in the 使用者介面 (UI)user interface (UI).

public:
 property bool IsEnabled { bool get(); void set(bool value); };
public bool IsEnabled { get; set; }
member this.IsEnabled : bool with get, set
Public Property IsEnabled As Boolean

屬性值

如果已啟用該項目則為 true,否則為 falsetrue if the element is enabled; otherwise, false. 預設值為 trueThe default value is true.

範例

下列範例Hyperlink會建立一個樣式, 其中包含屬性 setter, 當設定為IsEnabled false時, 會提供替代的視覺行為。The following example creates a style that includes a property setter that gives an alternate visual behavior when a Hyperlink is set to IsEnabled false.

<Style.Triggers>
  <Trigger Property="Hyperlink.IsEnabled" Value="false">
    <Setter Property="Foreground" Value="Gray"/>
  </Trigger>
  <Trigger Property="Hyperlink.IsMouseOver" Value="true">
    <Setter Property = "Foreground" Value="{StaticResource BlueGreenBrush}"/>
  </Trigger>
</Style.Triggers>

備註

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field IsEnabledProperty
中繼資料屬性設定為trueMetadata properties set to true None

適用於