Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
microsoft avatar

Winui Wpf Migration

  • 89 installs
  • 373 repo stars
  • Updated August 3, 2026
  • microsoft/win-dev-skills

winui-wpf-migration converts WPF apps to WinUI 3 with namespace and control mapping.

About

The winui-wpf-migration skill guides converting WPF applications to WinUI 3 on Windows. It audits System.Windows usage, creates a winui-mvvm project, and maps namespaces from System.Windows to Microsoft.UI.Xaml. Control tables cover DataGrid to ListView, WrapPanel to ItemsRepeater, TabControl to TabView, menus to MenuBar, and ToolBar to CommandBar. Threading replaces Dispatcher with DispatcherQueue via GetForCurrentThread. Imaging migration removes PresentationCore references early because they crash the WinUI XAML compiler, using BitmapImage or Windows.Graphics.Imaging. MVVM converts to CommunityToolkit.Mvvm with ObservableProperty and RelayCommand, DynamicResource to ThemeResource, and resx to resw. Critical rules forbid UseWPF, deleting Package.appxmanifest, and overwriting App.xaml boilerplate. Launch with winapp run. Use when converting WPF code or fixing WinUI migration build errors.

  • Audits WPF System.Windows usage before porting.
  • Maps controls, threading, imaging, and MVVM to WinUI.
  • Forbids PresentationCore and UseWPF references.
  • Migrates resx to resw localization files.
  • Requires winapp run for launching migrated apps.

Winui Wpf Migration by the numbers

  • 89 all-time installs (skills.sh)
  • +10 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #566 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

winui-wpf-migration capabilities & compatibility

Capabilities
namespace and control mapping tables · imaging migration rules · mvvm conversion guidance
Use cases
frontend
Platforms
Windows
IDEs
visual studio
From the docs

What winui-wpf-migration says it does

Migrate WPF applications to WinUI 3
SKILL.md
npx skills add https://github.com/microsoft/win-dev-skills --skill winui-wpf-migration

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs89
repo stars373
Last updatedAugust 3, 2026
Repositorymicrosoft/win-dev-skills

How do I migrate a WPF app to WinUI 3?

Migrate WPF desktop apps to WinUI 3 with namespace, control, threading, imaging, and MVVM replacements.

Who is it for?

Windows developers porting WPF desktop apps to WinUI 3.

Skip if: Skip for greenfield WinUI apps or non-Windows UI.

When should I use this skill?

User converts WPF code or fixes WinUI migration errors.

What you get

WinUI 3 project with mapped namespaces, controls, and MVVM patterns.

Files

SKILL.mdMarkdownGitHub ↗

Migration Process

Step 1: Audit the WPF Source

Before writing code, inventory WPF-specific APIs:

# Find all WPF namespace usage
Select-String -Path (Get-ChildItem -Recurse -Filter "*.cs" | Where-Object { $_.FullName -notlike "*\obj\*" }) -Pattern "System\.Windows\." | Select-Object -Property Filename, LineNumber, Line

List: WPF controls used, custom MVVM framework, imaging APIs, threading patterns, Win32 interop.

Step 2: Create WinUI 3 Project and Align Namespaces
dotnet new winui-mvvm -n <AppName>

Immediately set <RootNamespace> in .csproj to match the WPF namespace. Update x:Class in App.xaml, MainWindow.xaml and their code-behind files. Build to verify before porting any code.

Step 3: Replace Namespaces
WPFWinUI 3
System.WindowsMicrosoft.UI.Xaml
System.Windows.ControlsMicrosoft.UI.Xaml.Controls
System.Windows.MediaMicrosoft.UI.Xaml.Media
System.Windows.InputMicrosoft.UI.Xaml.Input
System.Windows.DataMicrosoft.UI.Xaml.Data
System.Windows.Threading.DispatcherMicrosoft.UI.Dispatching.DispatcherQueue
PresentationCore / PresentationFrameworkRemove entirely
Step 4: Replace Controls
WPF ControlWinUI 3 Equivalent
DataGridListView with Grid column headers
WrapPanelItemsRepeater + UniformGridLayout
TabControlTabView
StatusBarGrid row at bottom with TextBlock elements
Menu / MenuItemMenuBar / MenuBarItem / MenuFlyoutItem
ToolBarCommandBar
Expander (custom)Expander (built-in)
Step 5: Replace Threading
// WPF
Application.Current.Dispatcher.Invoke(() => { /* UI work */ });

// WinUI 3
dispatcherQueue.TryEnqueue(() => { /* UI work */ });

Get via DispatcherQueue.GetForCurrentThread(). No Application.Current.Dispatcher in WinUI 3.

Step 6: Replace Imaging

Critical: PresentationCore.dll and System.Windows.Media.Imaging crash the WinUI XAML compiler. This is an architectural incompatibility — no workaround exists.

  • Remove ALL System.Windows.Media.Imaging references at migration start
  • Replace with Windows.Graphics.Imaging (WinRT) or Microsoft.UI.Xaml.Media.Imaging.BitmapImage
  • Do NOT add <UseWPF>true</UseWPF> — it silently corrupts the build
  • If heavy imaging code exists, migrate it early (step 2, not step 7)
Step 7: Replace MVVM Framework

Delete custom ObservableObject/RelayCommand/DelegateCommand. Use CommunityToolkit.Mvvm:

  • INotifyPropertyChanged base → ObservableObject with [ObservableProperty] partial properties
  • Custom RelayCommand[RelayCommand] attribute
  • {Binding}{x:Bind Mode=OneWay}
  • DynamicResource{ThemeResource}
Step 8: Replace Resources
  • .resx.resw (copy + rename to Strings\en-us\)
  • {x:Static}x:Uid for localized strings
  • Properties.Resources.KeyResourceLoader.GetString("Key")

Critical Rules

  • ❌ NEVER reference PresentationCore, PresentationFramework, or System.Windows.Controls assemblies
  • ❌ NEVER add <UseWPF>true</UseWPF> or <WindowsPackageType>None</WindowsPackageType>
  • ❌ NEVER delete Package.appxmanifest
  • ❌ NEVER overwrite App.xaml / App.xaml.cs — merge WPF code into the WinUI 3 boilerplate
  • ✅ Always use winapp run to launch — never run the .exe directly
  • ✅ Break migration into file-level tasks — not one massive rewrite

Post-Migration Validation

# Check for remaining WPF references (should return nothing)
Select-String -Path (Get-ChildItem -Recurse -Filter "*.cs" | Where-Object { $_.FullName -notlike "*\obj\*" }) -Pattern "System\.Windows\."

# Verify packaging preserved
Test-Path "Package.appxmanifest"  # should be True

# Build and run
.\BuildAndRun.ps1

Related skills

FAQ

What does winui-wpf-migration do?

winui-wpf-migration converts WPF apps to WinUI 3 with namespace and control mapping.

When should I use winui-wpf-migration?

User converts WPF code or fixes WinUI migration errors.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.