# 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](https://docs.flatredball.com/gum/code/controls/frameworkelement) section.

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

## Available Controls

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