Loading...
Loading...
Migrate WPF applications to WinUI 3 — namespace replacement (System.Windows → Microsoft.UI.Xaml), control mapping (DataGrid→ListView, WrapPanel→ItemsRepeater, TabControl→TabView), threading (Dispatcher→DispatcherQueue), imaging (System.Drawing→BitmapImage), MVVM conversion to CommunityToolkit.Mvvm, and DynamicResource→ThemeResource. Use when converting WPF code, replacing WPF namespaces, or fixing migration build errors.
npx skill4agent add microsoft/win-dev-skills winui-wpf-migration# 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, Linedotnet new winui-mvvm -n <AppName><RootNamespace>.csprojx:ClassApp.xamlMainWindow.xaml| WPF | WinUI 3 |
|---|---|
| |
| |
| |
| |
| |
| |
| Remove entirely |
| WPF Control | WinUI 3 Equivalent |
|---|---|
| |
| |
| |
| |
| |
| |
| |
// WPF
Application.Current.Dispatcher.Invoke(() => { /* UI work */ });
// WinUI 3
dispatcherQueue.TryEnqueue(() => { /* UI work */ });DispatcherQueue.GetForCurrentThread()Application.Current.DispatcherPresentationCore.dllSystem.Windows.Media.ImagingSystem.Windows.Media.ImagingWindows.Graphics.ImagingMicrosoft.UI.Xaml.Media.Imaging.BitmapImage<UseWPF>true</UseWPF>ObservableObjectRelayCommandDelegateCommandINotifyPropertyChangedObservableObject[ObservableProperty]RelayCommand[RelayCommand]{Binding}{x:Bind Mode=OneWay}DynamicResource{ThemeResource}.resx.reswStrings\en-us\{x:Static}x:UidProperties.Resources.KeyResourceLoader.GetString("Key")PresentationCorePresentationFrameworkSystem.Windows.Controls<UseWPF>true</UseWPF><WindowsPackageType>None</WindowsPackageType>Package.appxmanifestApp.xamlApp.xaml.cswinapp run# 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