VisualElement.IsEnabled プロパティ

定義

この要素をユーザー インターフェイスで有効にするかどうかを示す値を取得または設定します。 これはバインド可能なプロパティです。

public bool IsEnabled { get; set; }
member this.IsEnabled : bool with get, set

プロパティ値

コンポーネントが有効な場合は true。それ以外の場合は false。 既定値は true です。

注釈

有効になっていない要素はヒット検出に参加しないため、フォーカスを受け取ったり、入力イベントを生成したりすることはありません。

次の例は、ボタンのハンドラーを示しています。これにより、別のボタンで IsEnabled が false に設定されます。

public partial class ButtonDisableExample {
  void BuildButtons ()
  {
    Button button1 = new Button {Text = "New button"};
    Button button2 = new Button {Text = "Disabled on click"};
    button1.Activated += (o, e) => button2.IsEnabled = false;
  }
}

適用対象