> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/code/controls/frameworkelement/isenabled.md).

# IsEnabled

### Introduction

IsEnabled controls whether the framework element responds to input from the user. Many controls reflect whether they are enabled visually, so a disabled element (such as a Button) appears differently than an enabled button.

### Code Example - Disabling a Control

Set `IsEnabled` to `false` to prevent a control from responding to user input. The control immediately transitions to its **Disabled** visual state.

```csharp
// Initialize
var button = new Button();
button.AddToRoot();
button.Text = "Purchase";
button.Width = 150;
button.Height = 40;

// Disable the button so it cannot be clicked
button.IsEnabled = false;
```

[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAACk3OMQvCMBAF4L3Q_3BkUhCroIvFQVG0m0jBpUuanPawJtBcVRT_u2lF63jf4z3uGQYAInGb-iJmwFWNg1bIEJMs6YGexVVWkNfM1sAcDN5g2R69fpyZjw8XWqd2by3_Y4p39o1M7OpKFdJhJrrwQJoLn46now63SKei6UwazEwUwYqczEsELvD7hLNADEoaYxlyBFWSOqP-rSRubZqO9kNHWTqMRRi8wuAN8rSfrO4AAAA)

### Cascading to Child Controls

Disabling a parent control also prevents all of its children from responding to input. Gum checks `IsEnabledRecursively` when processing cursor events, so a child whose own `IsEnabled` is `true` still ignores input when any ancestor is disabled. You do not need to disable each child individually.

```csharp
// Initialize
var panel = new StackPanel();
panel.AddToRoot();
panel.Width = 200;
panel.Height = 120;

var button1 = new Button();
button1.Text = "Button 1";
button1.Width = 180;
button1.Height = 40;
panel.AddChild(button1);

var button2 = new Button();
button2.Text = "Button 2";
button2.Width = 180;
button2.Height = 40;
panel.AddChild(button2);

// Disabling the parent panel disables all child controls
panel.IsEnabled = false;
```

[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAACo2QTUsDMRCG7wv7H4acKki7GzyIxYNfaG-iBS97STdjNxgnsplVUfzvJum2DajgMc-bmfdhPssCQCz89fAsToD7AQ8TMWTYKGs-MGDxqnp4UYQWToHwDe5ZtU-3EUwO5g2laHqm9dLdOccZezCauzAkq2rHbtCsOw6wlhE2FLevBmZH9bj_PL3SnjGYLvE9zjRik0HdiCzd9tTHVUZ3TUf79mB50RmrJ-On2JEryL8U5A8FmSnIXxXkfxTkRmE2g0vj1coaWgN3GA7eI_F4d50i9KCshTZOQ-uIe2f9du3CX1H8o0Pbo7Ie56IsvsriG-K32EvjAQAA)

### Visual State Change

When `IsEnabled` is set to `false`, the control transitions to its **Disabled** state category, which is defined in the Gum component's state machine. Most default controls (such as `Button`, `CheckBox`, and `ComboBox`) include a **Disabled** state that visually distinguishes them from their enabled counterparts — typically by reducing opacity or changing color. Setting `IsEnabled` back to `true` returns the control to its normal enabled state and triggers a full state update.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/gum/code/controls/frameworkelement/isenabled.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
