Share via

VisualElement.IsEnabled Property


Gets or sets a value indicating whether this element is enabled in the user interface. This is a bindable property.

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

Property Value


true if the element is enabled; otherwise, false. The default value is true


Elements that are not enabled do not participate in hit detection, and therefore will not receive focus or emit input events.

The following example shows a handler on a button which will then set IsEnabled to false on another button.

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;

Applies to