dotnet-wpf

Enforces strict MVVM conventions for WPF applications using CommunityToolkit.Mvvm and XAML data binding.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/envoydev/claude-stack --skill dotnet-wpf-envoydev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-wpf
Source: https://github.com/envoydev/claude-stack/tree/main/stack/skills/dotnet-wpf
Command: npx skills add https://github.com/envoydev/claude-stack --skill dotnet-wpf-envoydev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? WPF codebases drift into tangled code-behind, hand-rolled INotifyPropertyChanged boilerplate, deadlocking async commands, and untestable ViewModels. This Skill encodes a strict MVVM discipline so XAML, code-behind, and ViewModels stay on the correct side of the View-knows-ViewModel dependency line. ## Core Features & Use Cases - Strict MVVM architecture: One-way View-to-ViewModel dependency, CommunityToolkit.Mvvm source generators ([ObservableProperty], [RelayCommand]) instead of hand-written INotifyPropertyChanged, and commands instead of Click handlers. - Async command and threading rules: CancellationToken-carrying AsyncRelayCommands with local fault handling, IProgress<T> for off-UI-thread work, and list virtualization guidance for large collections. - Deep reference files: Dedicated references for the interaction layer (routed events, behaviors, clipboard payloads), advanced MVVM mechanics (dependency properties, weak events, validation), styling/theming with the .NET 9 Fluent ThemeMode, threading and lists, XAML style, FlaUI UI automation, and .NET Framework 4.8 constraints. - Use Case: Before editing a WPF screen's XAML or ViewModel, load this Skill so generated code uses source-generated observable properties, explicit binding modes, generic-host composition in App.xaml.cs, and resx-based localization instead of literal strings. ## Quick Start Load the dotnet-wpf skill before editing any XAML, code-behind, or ViewModel in this WPF project and refactor the OrderList screen to strict MVVM.

Frequently Asked Questions about dotnet-wpf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement MVVM in WPF with CommunityToolkit.Mvvm?▼

Derive the ViewModel from ObservableObject, declare backing fields with [ObservableProperty], and define commands with [RelayCommand] so the source generator emits the property, PropertyChanged raise, and IRelayCommand. Avoid hand-writing INotifyPropertyChanged with SetField boilerplate.

How do I run async commands in WPF without deadlocking?▼

Use a Task-returning method under [RelayCommand], which produces an AsyncRelayCommand, and take a CancellationToken as the last parameter. Never block on .Result or .Wait() behind a synchronous ICommand, since that deadlocks against the UI SynchronizationContext.

Does CommunityToolkit.Mvvm work on .NET Framework 4.8?▼

The runtime types work via the .NET Standard 2.0 assembly, but the source generators require PackageReference (not packages.config), C# 8.0 or higher, and a .NET 6 SDK or later build. A .NET Standard 2.0 class library for ViewModels is the robust fallback.

Why does my WPF theme switch only update half the UI?▼

Theme-dependent resources referenced with StaticResource resolve once at load time and never repaint. Use DynamicResource for brushes and theme-sensitive values so swapping the merged theme dictionary or setting the .NET 9 Fluent ThemeMode updates the whole UI.

When should I not use this WPF guidance?▼

Do not apply it to WinForms, UWP, WinUI 3, MAUI, Avalonia, or Uno, which are different frameworks with their own conventions. Compiled bindings (x:Bind) are a UWP/WinUI feature that WPF does not support.

How do I unit test a WPF ViewModel?▼

A ViewModel is a plain CLR object with no Window or Dispatcher dependency, so it tests directly without a UI host. Subscribe to PropertyChanged to assert notifications, call Execute on commands with mocked collaborators, and treat any test needing a Dispatcher as proof the MVVM line was crossed.