VisualElement.IsEnabled Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Remarks
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;
}
}