$npx -y skills add DevExpress/agent-skills --skill devexpress-winforms-layoutDevExpress WinForms Layout Management — form layout and docking controls: LayoutControl (free/flow/table layout modes, groups, tabbed groups, size constraints, runtime customization), DataLayoutControl (data-source-driven auto-generated editor layout, RetrieveFields, DataAnnotati
| 1 | # DevExpress WinForms Layout Management |
| 2 | |
| 3 | DevExpress WinForms ships a family of layout controls that cover form composition scenarios — from responsive data-entry forms to IDE-style dockable tool windows. The main controls ship in the **`DevExpress.Win.Navigation`** NuGet package; the lightweight `StackPanel`/`TablePanel` live in **`DevExpress.Utils`** (pulled in transitively). |
| 4 | |
| 5 | | Control | Class | Purpose | |
| 6 | |---|---|---| |
| 7 | | `LayoutControl` | `DevExpress.XtraLayout.LayoutControl` | Responsive data forms with auto-alignment, groups, tabs, and runtime customization | |
| 8 | | `DataLayoutControl` | `DevExpress.XtraDataLayout.DataLayoutControl` | Auto-generates editor layout from a bound data source | |
| 9 | | `DockManager` | `DevExpress.XtraBars.Docking.DockManager` | Visual Studio-style dockable, floatable, auto-hiding tool panels | |
| 10 | | `StackPanel` | `DevExpress.Utils.Layout.StackPanel` | Lightweight directional flow container (ships in `DevExpress.Utils`) | |
| 11 | | `TablePanel` | `DevExpress.Utils.Layout.TablePanel` | Lightweight rows-and-columns grid container (ships in `DevExpress.Utils`) | |
| 12 | |
| 13 | > **Common misconception**: There is no separate `FlowLayoutControl` or `TableLayoutControl` class. *Flow Layout* and *Table Layout* are **modes** (`LayoutMode`) on a `LayoutControlGroup` inside `LayoutControl`. |
| 14 | |
| 15 | > **Author layouts in the designer by default.** Generate the layout in the form's `*.Designer.cs` (`InitializeComponent`), the same way the Visual Studio WinForms designer serializes it — **not** in the form constructor body. Only build a layout in runtime code when the user explicitly asks for it or the structure is genuinely dynamic/data-driven. See rule 1 in **Constraints & Rules** and the worked example in [references/getting-started.md](references/getting-started.md#authoring-the-designercs-file). (For a form generated from a table or class, prefer `DataLayoutControl` + `RetrieveFields()` over a hand-built `LayoutControl`.) |
| 16 | |
| 17 | ## When to Use This Skill |
| 18 | |
| 19 | - Add a `LayoutControl` to a form and arrange editors with labels, groups, tabbed groups, and size constraints. |
| 20 | - Use `DataLayoutControl` to auto-generate a bound edit form from a DataTable or business object. |
| 21 | - Add a `DockManager` to enable VS-style dockable panel UI. |
| 22 | - Use `StackPanel` or `TablePanel` as lightweight layout containers. |
| 23 | - Save and restore any layout to XML, JSON, stream, or registry; or manage multiple layout slots with `WorkspaceManager`. |
| 24 | |
| 25 | ## Prerequisites & Installation |
| 26 | |
| 27 | ``` |
| 28 | DevExpress.Win.Navigation |
| 29 | ``` |
| 30 | |
| 31 | **Host form**: `DevExpress.XtraEditors.XtraForm` (or `RibbonForm`). |
| 32 | |
| 33 | **Namespaces**: |
| 34 | ```csharp |
| 35 | using DevExpress.XtraLayout; |
| 36 | using DevExpress.XtraLayout.Utils; // LayoutMode (Flow/Table layout mode) |
| 37 | using DevExpress.XtraDataLayout; |
| 38 | using DevExpress.XtraBars.Docking; |
| 39 | using DevExpress.XtraEditors; |
| 40 | using DevExpress.Utils.Layout; // StackPanel, TablePanel |
| 41 | ``` |
| 42 | |
| 43 | ## Before You Start — Ask the Developer |
| 44 | |
| 45 | If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's `AskUserQuestion` tool or GitHub Copilot's `askQuestions` tool. If no such tool is available, ask the questions directly in the chat response before generating code. |
| 46 | |
| 47 | 1. **Control type**: Which layout control is needed — `LayoutControl` (manual, labeled form), `DataLayoutControl` (data-driven auto-generated form — the default when the form is built **from a table or class**), `DockManager` (VS-style panels), or `StackPanel`/`TablePanel` (lightweight containers)? |
| 48 | 2 |