$npx -y skills add DevExpress/agent-skills --skill devexpress-winforms-mvvmDevExpress WinForms MVVM Framework with the MVVMContext component. Covers ViewModel types and priority order (compile-time DevExpress.Mvvm.CodeGenerators with [GenerateViewModel]/[GenerateProperty]/[GenerateCommand] preferred; runtime POCO with public virtual properties for legac
| 1 | # DevExpress WinForms MVVM Framework |
| 2 | |
| 3 | The DevExpress MVVM Framework lets you apply the Model-View-ViewModel pattern to WinForms applications. The `MVVMContext` component bridges a Form (View) and a ViewModel class: it manages the ViewModel lifecycle, resolves services, exposes a Fluent API for property binding and command binding, and hosts behaviors. |
| 4 | |
| 5 | The framework supports four ViewModel authoring styles. **Prefer the compile-time approach (DevExpress Code Generator or CommunityToolkit.Mvvm) for new projects** — it catches binding errors at compile time and produces clean, debuggable code. Use runtime POCO for existing `MVVMContext`-centric projects, and `ViewModelBase` only when class hierarchy constraints prevent using POCO. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | - Set up the `MVVMContext` component in a WinForms form (design-time or code). |
| 10 | - Choose a ViewModel type and write properties with `INotifyPropertyChanged` support. |
| 11 | - Declare synchronous (`DelegateCommand`) or asynchronous (`AsyncCommand`) commands with CanExecute. |
| 12 | - Bind editor properties and command buttons via the Fluent API (`SetBinding`, `BindCommand`). |
| 13 | - Register and call built-in DevExpress services (`IMessageBoxService`, `IDialogService`, `INavigationService`, etc.) without referencing UI from the ViewModel. |
| 14 | - Write custom services that implement an interface and are injected via `RegisterService`. |
| 15 | - Attach behaviors to controls (`ConfirmationBehavior`, `EventToCommandBehavior`, key shortcuts, custom `EventTriggerBase`). |
| 16 | - Communicate between ViewModels using the `Messenger`, parent-child relationships, `IDialogService`, `ISupportParameter`, or `NavigationService`. |
| 17 | |
| 18 | ## Prerequisites & Installation |
| 19 | |
| 20 | ### NuGet Packages |
| 21 | |
| 22 | | Package | Required For | Source | |
| 23 | |---|---|---| |
| 24 | | `DevExpress.Mvvm.CodeGenerators` | `[GenerateViewModel]`, `[GenerateProperty]`, `[GenerateCommand]` (compile-time) | NuGet.org — **free** | |
| 25 | | `DevExpress.Mvvm` | `ViewModelBase`, `DelegateCommand`, `AsyncCommand`, `Messenger`, `ISupportParameter` | NuGet.org — **free** | |
| 26 | | `DevExpress.Utils` | `MVVMContext`, runtime POCO framework, Fluent API | DevExpress feed — license required | |
| 27 | | Any `DevExpress.Win.*` | Includes `DevExpress.Utils`; adds UI controls | DevExpress feed — license required | |
| 28 | | `CommunityToolkit.Mvvm` | `ObservableObject`, `[ObservableProperty]`, `[RelayCommand]` (alternative) | NuGet.org — **free** | |
| 29 | |
| 30 | For most projects, install `DevExpress.Win.Navigation` (or any UI control package) plus `DevExpress.Mvvm.CodeGenerators` and `DevExpress.Mvvm`. |
| 31 | |
| 32 | ### Host Form Requirements |
| 33 | |
| 34 | Always use `XtraForm` (or `RibbonForm` when hosting a `RibbonControl`) as the base class — not plain `Form`. This ensures visual skin consistency and correct DevExpress component layout. |
| 35 | |
| 36 | ### Common Namespaces |
| 37 | |
| 38 | ```csharp |
| 39 | using DevExpress.Mvvm; // ViewModelBase, DelegateCommand, AsyncCommand, Messenger |
| 40 | using DevExpress.Mvvm.DataAnnotations; // BindableProperty, Command attributes (POCO) |
| 41 | using DevExpress.Mvvm.POCO; // ViewModelSource (runtime POCO) |
| 42 | using DevExpress.Mvvm.CodeGenerators; // GenerateViewModel, GenerateProperty, GenerateCommand |
| 43 | using DevExpress.Utils.MVVM; // MVVMContext |
| 44 | using DevExpress.XtraEditors; // XtraForm, SimpleButton, TextEdit, etc. |
| 45 | ``` |
| 46 | |
| 47 | ## Before You Start — Ask the Developer |
| 48 | |
| 49 | If the host agent has a str |