Install
$ agentstack add skill-devexpress-agent-skills-devexpress-wpf-mvvm ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
DevExpress WPF MVVM Framework
DevExpress.Mvvm is a full-featured MVVM framework for WPF — view-model base classes, code generators (compile-time and runtime), commands (sync and async), 25+ predefined services for typical UI tasks (message boxes, dialogs, document management, dispatcher, navigation, splash screens), behaviors that replace code-behind, and three view-model-communication mechanisms (parameter passing, parent-child relationships, messenger).
This skill covers picking the right view-model strategy, defining bindable properties and commands, calling services from view models, attaching behaviors, and routing data between view models.
When to Use This Skill
Use this skill when you need to:
- Pick a view-model strategy for a new or existing project
- Generate boilerplate code (properties, INotifyPropertyChanged, commands) at compile time
- Wire commands (sync
DelegateCommandor asyncAsyncCommand) to methods - Show message boxes / dialogs / file pickers / notifications from a view model
- Replace code-behind event handlers with behaviors (
EventToCommand,KeyToCommand, ...) - Pass initial data to a child view model (
ISupportParameter) - Access services registered on the parent view's view model from a child (
ISupportParentViewModel) - Broadcast notifications across loosely coupled view models (
Messenger)
Prerequisites & Installation
NuGet Packages
| Package | Provides | |---------|---------| | DevExpress.Wpf.Core | ViewModelBase, BindableBase, Messenger, all predefined services (IMessageBoxService, IDialogService, etc.), behaviors, dxmvvm: namespace | | DevExpress.Mvvm | Standalone MVVM library (the same types) — use when not bringing the rest of DX WPF | | DevExpress.Mvvm.CodeGenerators | Compile-time source generator for [GenerateViewModel] |
For a typical DevExpress WPF app, install DevExpress.Wpf.Core only — it brings everything. For a pure-MVVM library that doesn't reference UI controls, install DevExpress.Mvvm standalone.
For compile-time view-model generation, also install DevExpress.Mvvm.CodeGenerators:
dotnet add package DevExpress.Wpf.Core
dotnet add package DevExpress.Mvvm.CodeGenerators # for compile-time view models
Requirements per Strategy
| | POCO View Models (runtime) | View Models generated at compile time | |---|---|---| | C# version | 6+ | 9+ | | .NET Framework | 4.5.2+ | 4.6.1+ | | .NET Core | 3.0+ | 3.0+ | | VB support | Yes | No | | Debug-step into generated code | No | Yes |
For new projects, prefer the compile-time generator — better tooling, debuggable, no runtime reflection cost. Use POCO only when targeting older runtimes or VB.NET. Use ViewModelBase when integrating with code that already uses it.
A valid DevExpress license is required. All DevExpress packages in a project must share the same version.
XAML Namespaces
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
| Prefix | Use for | |---|---| | dxmvvm: | Interaction.Behaviors, EventToCommand, KeyToCommand, ViewModelSource, ViewModelExtensions, MessageBoxService (and most services) | | dx: | Some services live here too (e.g., DXMessageBoxService) — match what's in the docs |
View-Model Strategies — Picker
| Strategy | When to use | |---|---| | [GenerateViewModel] (compile-time, recommended) | New projects on C# 9+ / .NET 5+. Best tooling. | | ViewModelSource.Create() (POCO, runtime-generated) | When you need VB support, or compile-time generator is unavailable | | ViewModelBase (direct inheritance) | Existing codebases using it; when you need design-time helpers (OnInitializeInDesignMode / OnInitializeInRuntime) explicitly | | BindableBase | Minimal — only INotifyPropertyChanged boilerplate. Use when not pulling in the full MVVM framework. |
> Critical: don't mix view-model strategies arbitrarily. If your project already uses one strategy across most view models, keep using it. Compile-time is the recommended default for new code.
Detailed comparison: [references/viewmodels.md](references/viewmodels.md).
Before You Start — Ask the Developer
- Target framework: .NET 8+, .NET 6/7, or .NET Framework 4.x? (Compile-time generation requires .NET Framework 4.6.1+ or .NET Core 3.0+.)
- Existing view-model style: Does the project already use
ViewModelBase, POCO, or compile-time generation? If yes, match it. If no, default to compile-time[GenerateViewModel]. - Language: C# only or also VB.NET? VB requires runtime POCO or
ViewModelBase— compile-time gen is C#-only. - Service usage: Which services will be called from view models — message box / dialog / file picker / dispatcher? See [services.md](references/services.md).
- MVVM-style event handling: Are there event handlers in code-behind that should become behaviors? See [behaviors.md](references/behaviors.md).
- View-model communication: Do view models need to share data — parameter passing, parent reference, messenger? See [viewmodel-communication.md](references/viewmodel-communication.md).
Documentation & Navigation Guide
Getting Started
Refer to [references/getting-started.md](references/getting-started.md) (.NET 6/7/8+) or [references/getting-started-dotnet-fw.md](references/getting-started-dotnet-fw.md) (.NET Framework 4.x).
When you need to:
- Set up a new WPF project with the MVVM Framework
- Install the right NuGet packages
- Create the first view model and bind it to a view
View Models — Strategies, Properties, Commands
Refer to [references/viewmodels.md](references/viewmodels.md)
When you need to:
- Pick between compile-time generator, runtime POCO,
ViewModelBase, orBindableBase - Define
INotifyPropertyChangedproperties in each style - Wire
DelegateCommand/AsyncCommandto methods in each style - Migrate between styles
Services
Refer to [references/services.md](references/services.md)
When you need to:
- Show a message box, dialog, file picker, notification from a view model
- Register a service in XAML and call it from C#
- Use one of the 25+ predefined services
- Create a custom service
Behaviors
Refer to [references/behaviors.md](references/behaviors.md)
When you need to:
- Attach
EventToCommandto route an event to a view-model command - Use
KeyToCommandfor keyboard shortcuts - Use
FocusBehavior,ConfirmationBehavior,EnumItemsSourceBehavior, etc. - Write a custom
Behaviorclass
View-Model Communication
Refer to [references/viewmodel-communication.md](references/viewmodel-communication.md)
When you need to:
- Pass initialization data to a child view model (
ISupportParameter) - Give a child view model access to its parent (
ISupportParentViewModel) - Broadcast a notification across loosely coupled view models (
Messenger) - Pick the right communication mechanism
Quick Start — Compile-Time View Model
using DevExpress.Mvvm.CodeGenerators;
[GenerateViewModel]
partial class MainViewModel {
[GenerateProperty]
string username = "";
[GenerateProperty]
string status = "";
[GenerateCommand]
void Login() => Status = $"User: {Username}";
bool CanLogin() => !string.IsNullOrEmpty(Username);
}
The generator produces a partial class with the property + INPC + command boilerplate — no manual RaisePropertyChanged calls, no new DelegateCommand(...) wiring.
Quick Start — ViewModelBase (Traditional)
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
public class MainViewModel : ViewModelBase {
public string Username {
get => GetProperty(() => Username);
set => SetProperty(() => Username, value);
}
[Command]
public void Login() { /* ... */ }
public bool CanLogin() => !string.IsNullOrEmpty(Username);
}
The [Command] attribute auto-generates a LoginCommand property at runtime (via ICustomTypeDescriptor); Can[MethodName] is auto-discovered.
Quick Start — Runtime POCO
public class MainViewModel {
public virtual string Username { get; set; } = "";
public void Login() { /* ... */ }
public bool CanLogin() => !string.IsNullOrEmpty(Username);
protected MainViewModel() { }
public static MainViewModel Create() => DevExpress.Mvvm.POCO.ViewModelSource.Create(() => new MainViewModel());
}
The runtime generator wraps the class in a descendant that adds INotifyPropertyChanged to virtual properties and creates LoginCommand from the Login method.
Key API Surface
Commands
| Class | Use | |---|---| | DelegateCommand | Sync command (no parameter) | | DelegateCommand | Sync command with a typed parameter | | AsyncCommand | Async command (no parameter) — returns Task | | AsyncCommand | Async command with a typed parameter |
public ICommand SaveCommand => new DelegateCommand(Save, CanSave);
public ICommand LoadCommand => new AsyncCommand(LoadAsync);
In compile-time generation: [GenerateCommand] on a method auto-creates the command property (sync if the method returns void, async if it returns Task).
ViewModelBase Members
| Member | Use | |---|---| | GetProperty(() => Prop) / SetProperty(() => Prop, value) | Bindable property pattern (expression-based) | | GetService() | Resolve a service registered on the view | | OnInitializeInRuntime() / OnInitializeInDesignMode() | Different initialization for design vs runtime | | OnParameterChanged(object) | Receive data passed via ISupportParameter | | OnParentViewModelChanged(object) | Receive parent VM reference | | IsInDesignMode | Detect designer mode |
Compile-Time Attributes (DevExpress.Mvvm.CodeGenerators)
| Attribute | Use | |---|---| | [GenerateViewModel] (on class) | Tells the source generator to emit boilerplate | | [GenerateProperty] (on field) | Emit a public property + INPC raise | | [GenerateCommand] (on method) | Emit a Command property |
GenerateViewModel properties: ImplementINotifyPropertyChanging, ImplementIDataErrorInfo, ImplementISupportServices, ImplementISupportParentViewModel.
Predefined Services (Selected)
| Service | Use | |---|---| | IMessageBoxService (DXMessageBoxService / WinUIMessageBoxService) | Show message boxes | | IDialogService (DialogService / WinUIDialogService) | Show modal dialogs with a view | | IDocumentManagerService (WindowedDocumentUIService, TabbedDocumentUIService, ...) | Manage tabbed / windowed / docked documents | | IOpenFileDialogService / ISaveFileDialogService / IFolderBrowserDialogService | Standard file/folder pickers | | INotificationService | Toast-style notifications | | INavigationService | Navigate between views inside a NavigationFrame | | IDispatcherService | Marshal work onto the UI dispatcher | | ISplashScreenManagerService | Show a splash screen from a VM | | ICurrentWindowService / ICurrentDialogService | Control the hosting window from a VM | | IWindowService | Show a view as a separate window |
Full list: [services.md](references/services.md).
Common Patterns
Pattern 1: Compile-Time VM with Services
using DevExpress.Mvvm;
using DevExpress.Mvvm.CodeGenerators;
[GenerateViewModel(ImplementISupportServices = true)]
partial class MainViewModel {
IMessageBoxService MessageBox =>
ServiceContainer.GetService(ServiceSearchMode.PreferParents);
[GenerateCommand]
void ShowAbout() => MessageBox.ShowMessage("MyApp v1.0");
}
...
Pattern 2: Async Command with Progress
[GenerateViewModel]
partial class MainViewModel {
[GenerateProperty]
bool isBusy;
[GenerateCommand]
async Task LoadAsync() {
IsBusy = true;
try { await FetchDataAsync(); }
finally { IsBusy = false; }
}
}
AsyncCommand is auto-detected when the method returns Task. Use AllowMultipleExecution = true on [GenerateCommand] to allow re-entry.
Pattern 3: Behavior — Event to Command
No code-behind needed; double-click routes to EditCommand on the view model.
Pattern 4: Pass Data to Child VM
The detail view-model's OnParameterChanged(object) is invoked with the new value.
Pattern 5: Messenger Broadcast
// Sender
Messenger.Default.Send("ItemAdded");
// Receiver (subscribe in ctor)
Messenger.Default.Register(this, OnMessage);
void OnMessage(string msg) { /* react */ }
Loosely coupled — sender and receiver don't know about each other.
Troubleshooting
| Symptom | Cause | Solution | |---|---|---| | [GenerateViewModel] doesn't emit any code | DevExpress.Mvvm.CodeGenerators package missing, or C# 9 (or higher) in .csproj. | | Compile-time generated code can't be found | Generated files aren't visible in plain code search | Use **Peek Definition** (F12) on a generated member, or look under Dependencies → Analyzers → DevExpress.Mvvm.CodeGenerators in Solution Explorer. | | ViewModelSource.Create throws "type must be public and not sealed" | POCO classes need public non-sealed classes with virtual properties | Make the class public and properties virtual. | | Command attribute method doesn't become a command | Class doesn't inherit from ViewModelBase, or method is private | Inherit from ViewModelBase and make the method public. | | GetService() returns null | Service not registered on the view via | Add the service to the view's behaviors collection. | | Messenger.Default.Register listener never fires | Recipient was garbage-collected (Messenger uses weak refs by default), or message types don't match | Keep a reference to the recipient; verify TMessage types are exactly the same. | | OnParameterChanged not invoked | ViewModelExtensions.Parameter attached property assigned with wrong binding (DataContext == DetailVM, but should reference Main VM) | Use {Binding DataContext, ElementName=LayoutRoot} not {Binding}. | | Behavior doesn't attach | Missing dxmvvm: namespace, or behavior not in collection | Add namespace xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"` and wrap behaviors in the collection. |
Constraints & Rules
CRITICAL — follow these rules in every interaction:
- Build verification: After changes, run
dotnet buildand report errors before claiming success. - Target framework: Windows-only (
net{X}-windows,UseWPF=true). - NuGet:
DevExpress.Wpf.Core(orDevExpress.Mvvmfor the standalone library). AddDevExpress.Mvvm.CodeGeneratorsfor compile-time generation. - For new projects, prefer compile-time
[GenerateViewModel]. Use POCO/ViewModelBaseonly when constrained (VB, older runtime, existing codebase). - Don't mix view-model strategies within a project unless there's a deliberate reason — pick one and stick with it.
- XAML namespaces:
dxmvvm:(MVVM framework primitives). Some services usedx:— check the docs per service. - POCO requires
virtualon properties and apublicnon-sealed class. Don't tryViewModelSource.Createon sealed classes. Messenger.Defaultuses weak references — keep recipients alive (typically members on a long-lived view model) or messages won't fire.
Using DevExpress Documentation MCP
- Search:
devexpress_docs_search(technology="WPF", query="MVVM view model service behavior") - Fetch:
devexpress_docs_get_content(url="https://docs.devexpress.com/WPF/17414")
Use MCP for: specific service APIs (each predefined service has its own configuration), advanced compile-time generation scenarios (Prism, MVVM Light), Dependency Injection patterns, custom servi
…
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: DevExpress
- Source: DevExpress/agent-skills
- License: MIT
- Homepage: https://www.devexpress.com
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.