dotnet-wpf

Build and modernize WPF applications with MVVM, data binding, commands, and threading patterns.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-wpf-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-wpf
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-wpf
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-wpf-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? WPF development involves subtle pitfalls: silent binding failures, UI thread violations, memory leaks from event handlers, and tangled code-behind logic. This Skill provides correct patterns for XAML, MVVM, data binding, commands, threading, and styling, plus guidance for migrating WPF apps from .NET Framework to modern .NET. ## Core Features & Use Cases - MVVM Implementation: Build testable ViewModels using the MVVM Toolkit with source-generated properties, RelayCommand, and validation via ObservableValidator. - Binding & Threading Guidance: Apply correct binding modes, value converters, Dispatcher usage, and async/await patterns to avoid frozen UIs and cross-thread crashes. - Migration & Modernization: Get grounded advice for moving WPF apps from .NET Framework to .NET while respecting Windows-only constraints. - Use Case: You are modernizing a legacy WPF inventory app. Use this Skill to refactor code-behind logic into ViewModels, fix binding errors, and virtualize a 50,000-row DataGrid. ## Quick Start Use the dotnet-wpf skill to refactor my MainWindow code-behind into an MVVM ViewModel with async commands and proper data binding.

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 a WPF application?▼

Implement MVVM in WPF by keeping XAML views free of business logic and placing state and commands in ViewModels. Use the CommunityToolkit MVVM attributes like [ObservableProperty] and [RelayCommand] to generate INotifyPropertyChanged and ICommand implementations automatically.

How do I update the WPF UI from a background thread?▼

Update the WPF UI from a background thread using Application.Current.Dispatcher.Invoke or InvokeAsync. Prefer async/await, since code after an await resumes on the UI thread automatically, avoiding manual dispatcher calls.

Can WPF applications run on Linux or macOS?▼

WPF is Windows-only, even when the wider .NET stack is cross-platform. If you need a cross-platform .NET desktop UI, you must choose a different framework such as Avalonia or MAUI instead of WPF.

Why is my WPF binding not updating the UI?▼

WPF bindings fail silently when the source object does not implement INotifyPropertyChanged or the binding path has a typo. Enable PresentationTraceSources.DataBindingSource logging in debug builds and use ObservableObject from the MVVM Toolkit for change notification.

How do I migrate a WPF app from .NET Framework to .NET?▼

Migrate WPF to modern .NET by updating the project file to the SDK-style format with net8.0-windows and UseWPF, then fixing API incompatibilities. The official Microsoft migration guide covers the try-convert tool and manual upgrade steps.

How do I prevent memory leaks in WPF event handlers?▼

Prevent WPF memory leaks by unsubscribing from events in IDisposable implementations or using WeakEventManager and WeakReferenceMessenger. Static events and bindings to objects without INotifyPropertyChanged are common leak sources.