$npx -y skills add DevExpress/agent-skills --skill devexpress-wpf-pivot-gridBuild WPF applications with the DevExpress Pivot Grid (PivotGridControl) — a control for multi-dimensional data analysis displaying data in a cross-tabular pivot table. Use when adding PivotGridControl to a WPF project, binding to DataSet/DataTable, Entity Framework, OLAP cubes,
| 1 | # DevExpress WPF Pivot Grid (PivotGridControl) |
| 2 | |
| 3 | The DevExpress WPF Pivot Grid (`DevExpress.Xpf.PivotGrid.PivotGridControl`) creates pivot tables for multi-dimensional data analysis. Large data sets are summarized in a cross-tabular layout that end users can sort, group, filter, drill down into, and visualize with charts or KPIs. Fields are positioned in four header areas — **Row**, **Column**, **Data**, **Filter** — and users can drag them between areas at runtime to reshape the report. Unlike `GridControl` (which uses `ItemsSource`), the Pivot Grid binds via the `DataSource` property and creates `PivotGridField` objects bound to columns of that source. |
| 4 | |
| 5 | > **PivotGrid vs. GridControl**: `GridControl` is for tabular records — each row is one record. `PivotGridControl` is for **aggregated** data — each cell is a calculation (sum, count, average) at the intersection of row and column field values. If you need to show a list of orders, use `GridControl`. If you need to see "total sales per Country × Year", use `PivotGridControl`. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | Use this skill when you need to: |
| 10 | |
| 11 | - Build a cross-tab report from a `DataTable`, list, or query result |
| 12 | - Bind to a Microsoft Analysis Services OLAP cube |
| 13 | - Bind to a server-mode source (very large data, server-side aggregation) |
| 14 | - Bind to in-memory data (`List<T>`) with the Optimized processing engine |
| 15 | - Bind asynchronously (background-thread data fetch and aggregation) |
| 16 | - Create fields in the Row, Column, Data, or Filter area programmatically |
| 17 | - Apply grouping intervals (`DateYear`, `DateMonth`, `Alphabetical`, custom numeric ranges) |
| 18 | - Customize aggregation functions (Sum, Count, Average, Min, Max, Custom) |
| 19 | - Add KPI displays for executive dashboards |
| 20 | - Apply conditional formatting (Excel-style cell formatting) |
| 21 | - Integrate with `ChartControl` for visual drill-down |
| 22 | - Print, preview, or export to PDF / XLSX / HTML / CSV / RTF / MHT / TXT |
| 23 | - Save and restore pivot layout across sessions |
| 24 | - Migrate from Microsoft `PivotTable` or third-party pivot controls |
| 25 | |
| 26 | ## Prerequisites & Installation |
| 27 | |
| 28 | ### NuGet Packages |
| 29 | |
| 30 | | Package | Purpose | |
| 31 | |---------|---------| |
| 32 | | `DevExpress.Wpf.PivotGrid` | Main package — `PivotGridControl`, `PivotGridField`, all bindings | |
| 33 | | `DevExpress.Wpf.Printing` | Required for Print Preview and export | |
| 34 | | `DevExpress.Wpf.Charts` | Optional, for Chart integration | |
| 35 | |
| 36 | All DevExpress packages in a project must share the same version. |
| 37 | |
| 38 | ### .NET 8+ |
| 39 | |
| 40 | ```bash |
| 41 | dotnet add package DevExpress.Wpf.PivotGrid |
| 42 | ``` |
| 43 | |
| 44 | Add `<TargetFramework>net8.0-windows</TargetFramework>` and `<UseWPF>true</UseWPF>` to `.csproj`. Pivot Grid is Windows-only. |
| 45 | |
| 46 | ### .NET Framework (4.6.2+) |
| 47 | |
| 48 | See [references/getting-started-dotnet-fw.md](references/getting-started-dotnet-fw.md). |
| 49 | |
| 50 | **Important**: All DevExpress packages in a project must share the same version. A valid DevExpress license is required. |
| 51 | |
| 52 | ## Before You Start — Ask the Developer |
| 53 | |
| 54 | 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. |
| 55 | |
| 56 | Before generating code, ask these questions to avoid rework: |
| 57 | |
| 58 | ### General Questions |
| 59 | 1. **Target framework**: .NET 8+ or .NET Framework 4.x? |
| 60 | 2. **New or existing project**: Creating a new WPF app, or adding `PivotGridControl` to an existing one? |
| 61 | 3. **DevExpress version**: Which version (e.g., 24.2, 25.1, 26.1)? All DX packages must use the same version |