# Controls

## Introduction

This section covers the Gum Forms controls — a set of interactive UI controls built on top of the Gum layout system. Forms controls combine visual appearance with built-in interaction logic, making it straightforward to build game UI without writing low-level input handling code.

## How Forms Controls Differ from Raw GraphicalUiElement Usage

When you use a raw `GraphicalUiElement` (or one of the standard visuals like `SpriteRuntime` or `ColoredRectangleRuntime`), you get full layout control but no interaction logic. Forms controls add:

* **Built-in interaction logic** — buttons respond to clicks, text boxes accept keyboard input, list boxes handle selection, and so on.
* **Default visuals** — each control ships with a default appearance so it works out of the box without a Gum project file.
* **State machines** — controls automatically transition between visual states (e.g., `Enabled`, `Disabled`, `Highlighted`, `Pushed`) in response to user input.

## FrameworkElement — The Base Class

Every Forms control inherits from `FrameworkElement`. It provides the common foundation shared by all controls, including:

* `IsEnabled` — disables a control so it stops receiving input.
* `IsFocused` — tracks whether the control currently has keyboard focus.
* Layout shortcuts (`X`, `Y`, `Width`, `Height`, `Anchor`, `Dock`) that forward to the underlying `Visual` property.
* Data binding support via `SetBinding` and `BindingContext`.

For details on these shared members, see the [FrameworkElement](/gum/code/controls/frameworkelement.md) section.

All controls can be tested on [XnaFiddle](https://xnafiddle.net/), so feel free to try them out there.

## Available Controls

* [Button](/gum/code/controls/button.md)
* [CheckBox](/gum/code/controls/checkbox.md)
* [ComboBox](/gum/code/controls/combobox.md)
* [FrameworkElement](/gum/code/controls/frameworkelement.md)
* [Grid](/gum/code/controls/grid.md)
* [ItemsControl](/gum/code/controls/itemscontrol.md)
* [Label](/gum/code/controls/label.md)
* [ListBox](/gum/code/controls/listbox.md)
* [ListBoxItem](/gum/code/controls/listboxitem.md)
* [Menu](/gum/code/controls/menu.md)
* [MenuItem](/gum/code/controls/menuitem.md)
* [PasswordBox](/gum/code/controls/passwordbox.md)
* [RadioButton](/gum/code/controls/radiobutton.md)
* [ScrollBar](/gum/code/controls/scrollbar.md)
* [ScrollViewer](/gum/code/controls/scrollviewer.md)
* [StackPanel](/gum/code/controls/stackpanel.md)
* [Slider](/gum/code/controls/slider.md)
* [Splitter](/gum/code/controls/splitter.md)
* [TextBox](/gum/code/controls/textbox.md)
* [Window](/gum/code/controls/window.md)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/gum/code/controls.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
