wpf-to-winui3-migration
Skill142k starsChanged 39 days agoMITView on GitHub
Guide for migrating PowerToys modules from WPF to WinUI 3 (Windows App SDK). Use when asked to migrate WPF code, convert WPF XAML to WinUI, replace System.Windows namespaces with Microsoft.UI.Xaml, update Dispatcher to DispatcherQueue, replace DynamicResource with ThemeResource, migrate imaging APIs from System.Windows.Media.Imaging to Windows.Graphics.Imaging, convert WPF Window to WinUI Window, migrate .resx to .resw resources, migrate custom Observable/RelayCommand to CommunityToolkit.Mvvm source generators, handle WPF-UI (Lepo) to WinUI native control migration, or fix installer/build pipeline issues after migration. Keywords: WPF, WinUI, WinUI3, migration, porting, convert, namespace, XAML, Dispatcher, DispatcherQueue, imaging, BitmapImage, Window, ContentDialog, ThemeResource, DynamicResource, ResourceLoader, resw, resx, CommunityToolkit, ObservableProperty, WPF-UI, SizeToContent, AppWindow, SoftwareBitmap.
Trending
More talk lately.about the whole repository
Who's talking about microsoft/PowerToys
- A Hacker News story“Fancy Zones, a tiling window manager”Hacker News · Sep 6, 2019 · 507 points
- A Hacker News story“PowerToys: Windows system utilities to maximize productivity”Hacker News · Sep 5, 2019 · 343 points
- A Hacker News story“PowerToys – Windows system utilities to maximize productivity”Hacker News · May 7, 2019 · 82 points
- snowie2000/mactype“Generic Subpixel Algorithm for Triangular-Structure QD-OLEDs / Pentile / WOLED / Others”GitHub · Apr 20, 2023 · 42 reactions
- A Hacker News story“PowerToys Release 0.70 with Mouse Without Borders and PowerToys Peek”Hacker News · May 24, 2023 · 41 points
The biggest 5 of 111 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 111
Talked about on GitHub, Bluesky and Hacker News (111 times).
On GitHub · 42
- Apr 20, 2023Generic Subpixel Algorithm for Triangular-Structure QD-OLEDs / Pentile / WOLED / Others — snowie2000/mactype42 reactions · 32 comments
- Oct 10, 2023Option to disable subpixel rendering on Windows instead of having to use CLI argument — microsoft/vscode28 reactions · 11 comments
- Mar 31, 2020Powertoys — QL-Win/QuickLook23 reactions · 2 comments
- May 18, 2021Obsolete due to MS PowerToys — tibold/svg-explorer-extension16 reactions · 11 comments
- Apr 30, 2026No results since vscode 1.118 — taooceros/Flow.Plugin.VSCodeWorkspace10 reactions · 4 comments
37 more on GitHub
- Jan 28, 2026(powertoys) 0.97.1's download URL is incorrect — mkevenaar/chocolatey-packages9 reactions · 1 comment
- Oct 13, 2023Tracking issue for DSC Resources — microsoft/winget-cli8 reactions
- Apr 20, 2022Question: When will InfoBadge be available in WinUI3? — microsoft/microsoft-ui-xaml8 reactions · 2 comments
- Apr 8, 2026Suggested fix for Windows host 1.4.6 breaks text input from iOS and Android (Resulted in modifier keys general fix) — rustdesk/rustdesk5 reactions · 38 comments
- Oct 17, 2026Remove version: Microsoft.PowerToys version 0.102.2862.0 — microsoft/winget-pkgs2 reactions · 9 comments
- Jun 11, 2026powertoys@0.100.0: Fix runtime issues by copying required files in the installer script — ScoopInstaller/Extras2 reactions · 3 comments
- Dec 6, 2023DwmGetColorizationParameters fallback in case of failure #593 — lepoco/wpfui2 reactions · 1 comment
- Dec 13, 2022Implement IFileDropResult to support drag&drop of results — lin-ycv/EverythingPowerToys2 reactions
- Sep 29, 2021add other localization resources — Flow-Launcher/Flow.Plugin.WindowsSettings2 reactions · 1 comment
- Apr 27, 2026[codex] Add low memory mode for supported utilities — Michaelihc/PowerToys1 reaction · 3 comments
- Feb 14, 2026Adds Microsoft PowerToys to Tools section — phoboslab/qoi1 reaction
- Jan 30, 2026PowerToys: Correct Typo in chocolateyinstall.ps1 $url64 Value — mkevenaar/chocolatey-packages1 reaction · 3 comments
- Oct 30, 2025[PowerToys Awake] Clarify lock screen behavior, add security considerations — MicrosoftDocs/windows-dev-docs1 reaction · 5 comments
- Oct 28, 2025[PowerToys] Shortcut Guide V2 docs — MicrosoftDocs/windows-dev-docs1 reaction · 15 comments
- Feb 21, 2025Update InvokeTestingPlatformTask to prefer running Exe over `dotnet exec dll` — microsoft/testfx1 reaction · 9 comments
- Feb 11, 2025Add Extensions page to Settings UI — microsoft/terminal1 reaction · 9 comments
- Jan 7, 2025Remove workaround that's not needed anymore — MicrosoftDocs/windows-dev-docs1 reaction · 9 comments
- Dec 18, 2024chore: configure Dependabot for GitHub Actions updates — microsoft/markitdown1 reaction · 1 comment
- Aug 5, 2024Updated Awake settings — MicrosoftDocs/windows-dev-docs1 reaction · 3 comments
- Jul 15, 2024Update PowerToys script to newer tag — mkevenaar/chocolatey-packages1 reaction · 5 comments
- Jul 15, 2024powertoys@0.82.1: Fix for the tag change — ScoopInstaller/Extras1 reaction · 3 comments
- May 14, 2024PowerToys PowerRename random values feature docs — MicrosoftDocs/windows-dev-docs1 reaction · 4 comments
- May 2, 2024Create similarIssues.yml which automatically comments with similar issues on the repo — dotnet/maui1 reaction · 4 comments
- Jan 25, 2024Update copyright year and copyright string — microsoft/WinUI-Gallery1 reaction · 2 comments
- Jan 22, 2024Add PowerToys Text Extractor — dynobo/normcap1 reaction · 2 comments
- Nov 21, 2023Implement FREETYPE_CUSTOM_GEOMETRY environment variable for unusual subpixel formats — rennr/freetype1 reaction · 15 comments
- Nov 13, 2023PowerToys Run for 0.75.1 requires Plugin ID in Main — bostrot/PowerToysRunPluginWinget1 reaction · 6 comments
- Aug 31, 2023[PowerToys][FindMyMouse] Add new activation methods — MicrosoftDocs/windows-dev-docs1 reaction · 2 comments
- Jun 4, 2023[Peek] Update docs to reflect new navigation keys — MicrosoftDocs/windows-dev-docs1 reaction · 6 comments
- May 15, 2023[PowerToys] Add Peek docs — MicrosoftDocs/windows-dev-docs1 reaction · 9 comments
- Apr 5, 2023[SettingsControls] Accessibility improvements — CommunityToolkit/Labs-Windows1 reaction · 2 comments
- Dec 30, 2022Use localized name for shell link programs — Flow-Launcher/Flow.Launcher1 reaction · 7 comments
- Dec 11, 2022Update quick-accent.md — MicrosoftDocs/windows-dev-docs1 reaction · 3 comments
- Oct 22, 2022[Program Plugin] Fix program UID and other bugs — Flow-Launcher/Flow.Launcher1 reaction · 4 comments
- Sep 30, 2022PowerToys text improvements — MicrosoftDocs/windows-dev-docs1 reaction · 12 comments
- Jul 23, 2022[PowerToys] Docs update for activation command change — MicrosoftDocs/windows-dev-docs1 reaction · 10 comments
- Jun 23, 2022v0.59.0 added support for arm — MicrosoftDocs/windows-dev-docs1 reaction · 1 comment
On Bluesky · 41
- Jan 22, 2026Hot tip: Turns out you can disable the Copilot button on the keyboard with the keyboard remapping tool (map it onto the left-ctrl button… — @keithng.bsky.social14 likes and reposts · 2 replies
- Sep 7, 2023برای استخراج متن از تصویر در ویندوز Microsoft PowerToys رو از گیتهاب دانلود و نصب کنید. github.com/microsoft/Po... وارد تنظیمات اون بشید… — @yetanotheruserhere.bsky.social9 likes and reposts
- Jan 8, 2025So, let me get this straight. Microsoft (yes, actually them) developed an OPEN SOURCE addon for Windows that adds a bunch of use of useful… — @dzaladan.eurosky.social5 likes and reposts
- Aug 12, 2023https://learn.microsoft.com/en-us/windows/powertoys/ — @starsetbyte.lol5 likes and reposts · 2 replies
- Jan 6, 2026📦 microsoft / PowerToys ⭐ 127,159 (+46) 🗒 C# Microsoft PowerToys is a collection of utilities that help you customize Windows and… — @github-trending.bsky.social4 likes and reposts
36 more on Bluesky
- May 16, 2025📦 microsoft / PowerToys ⭐ 118,571 (+41) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social3 likes and reposts
- May 7, 2025Microsoft... Faut les sucer en chantant "Microsoft est le plus grand contributeur du libre au monde, Microsoft est beau, Microsoft est… — @zurbo.fr3 likes and reposts · 1 reply
- Mar 23, 2025powertoys fancyzones, get that shit fixed up github.com/microsoft/Po... — @ket.bsky.social3 likes and reposts · 1 reply
- Jan 7, 2025If you're a Windows user, this bundle of efficiency gadgets from @microsoft.com should be definitely on your radar!… — @jankabatek.com3 likes and reposts
- Dec 19, 2024📦 microsoft / PowerToys ⭐ 112,455 (+71) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social3 likes and reposts
- Jan 11, 2024📦 microsoft / PowerToys ⭐ 100,904 (+86) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social3 likes and reposts
- Nov 22, 20232. download Windows PowerToys and find the Text Extractor module. The default keybind Win-Shift-T lets you select text directly from your… — @meganox.myatproto.social3 likes and reposts · 2 replies
- Oct 31, 2023Why?! 😶 Why haven't I installed MS PowerToys sooner? 😒 Love them! 😍 — @ferociousbyte.dev3 likes and reposts · 1 reply
- Dec 12, 2025github.com/microsoft/Po... learn.microsoft.com/en-us/window... indeed, it does! have some relevant links :) — @auralyn.northsky.social2 likes and reposts
- Oct 17, 2025📦 microsoft / PowerToys ⭐ 124,453 (+79) 🗒 C# Microsoft PowerToys is a collection of utilities that help you customize Windows and… — @github-trending.bsky.social2 likes and reposts
- Jul 29, 2025📦 microsoft / PowerToys ⭐ 121,315 (+82) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social2 likes and reposts
- Mar 10, 2025PowerToys has some useful tools too github.com/microsoft/Po... — @emeraldfox.gay2 likes and reposts
- Mar 6, 2025📦 microsoft / PowerToys ⭐ 115,374 (+62) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social2 likes and reposts
- Jan 28, 2025You rang? PowerToys: github.com/microsoft/Po... AI Dev Gallery: github.com/microsoft/AI... — @baldbeardedbuilder.com2 likes and reposts · 2 replies
- Jan 14, 2025It's free, open source, and developed by Microsoft. github.com/microsoft/Po... — @crossmod.bsky.social2 likes and reposts
- Sep 5, 2024📦 microsoft / PowerToys ⭐ 108,627 (+60) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social2 likes and reposts
- Nov 13, 2026🚀 GitHub Intelligence Drop gstack (TypeScript • 🟢) ⭐ 141.5K → https://github.com/garrytan/gstack PowerToys (C • 🟢) ⭐ 141K →… — @githubfeed.bsky.social1 likes and repost
- Sep 11, 2026Power Display within PowerToys would probably work for ya - github.com/microsoft/Po... — @siberionhusky.bsky.social1 likes and repost
- Jun 12, 2026I just starred microsoft/PowerToys on GitHub: https://github.com/microsoft/PowerToys — @chiefgyk3d.com1 likes and repost
- Apr 1, 2026I really find the Mouse Without Borders tool (part of github.com/microsoft/Po...) super useful. There's a few rough edges for features I'd… — @david.gardiner.net.au1 likes and repost · 1 reply
- Jan 31, 2026📦 microsoft / PowerToys ⭐ 128,642 (+61) 🗒 C# Microsoft PowerToys is a collection of utilities that help you customize Windows and… — @github-trending.bsky.social1 likes and repost
- Nov 9, 2025And last but not least, in fact very important, is powertoy, and the command palette github.com/microsoft/Po... — @vnphanquang.com1 likes and repost
- Sep 17, 20251. FlipFlip by StarrHelixx github.com/ififfy/flipf... For studying art REFs 2. PureRef www.pureref.com 2. Draw-IO www.drawio.com —… — @mireu9999.bsky.social1 likes and repost · 1 reply
- May 21, 2025📦 microsoft / PowerToys ⭐ 118,951 (+95) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social1 likes and repost
- Feb 16, 2025GitHub: github.com/microsoft/Po... — @rand0mbits.bsky.social1 likes and repost
- Feb 3, 2025microsoft power toys has a window manager that lets you do exactly that - set custom zones for each display… — @lucyluuu.me1 likes and repost · 1 reply
- Dec 22, 2024Two must haves on every new Windows laptop I have github.com/microsoft/Po... Powertools and www.voidtools.com Everything Pretty much lets… — @nathanbeddoe.com1 likes and repost
- Sep 23, 2024Github, too github.com/microsoft/Po... — @obol.bsky.social1 likes and repost
- Sep 16, 2024https://github.com/microsoft/PowerToys Interesting — @yee.nu1 likes and repost
- Mar 17, 2024Años buscando cómo cambiar el mapa de caracteres de mi teclado en Windows y resulta que existía esto publicado por el propio Microsoft.… — @jmbeas.es1 likes and repost · 1 reply
- Sep 29, 2023📦 microsoft / PowerToys ⭐ 95,738 (+58) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social1 likes and repost
- Sep 4, 2023Favorite productivity tools that I use daily: 1) PowerToys - github.com/microsoft/Po... - fancy zones, text extractor, and more 2) Beeftext… — @drewmaust.bsky.social1 likes and repost
- Oct 18, 2025Ny Powertoys (om du ikke bruker det, get it!) har nå fått Light Switch og Peek! Light Switch endrer automatisk light/dark mode basert på… — @visn.es0 likes and reposts · 1 reply
- Sep 4, 2025📦 microsoft / PowerToys ⭐ 122,846 (+52) 🗒 C# Windows system utilities to maximize productivity — @github-trending.bsky.social0 likes and reposts · 1 reply
- Aug 21, 2025I discovered that PowerToys for Windows is a thing. * Spotlight-like search with Alt+Space; * Caffeine-like app to prevent the PC from… — @andrey.nering.dev0 likes and reposts · 1 reply
- Aug 12, 2025Eine Auswahl der Tools: https://github.com/memstechtips/WIMUtil https://github.com/memstechtips/UnattendedWinstall… — @sebastianlaube.layer8.space.ap.brid.gy0 likes and reposts · 1 reply
On Hacker News · 28
- Sep 6, 2019Fancy Zones, a tiling window manager507 points · 163 comments
- Sep 5, 2019PowerToys: Windows system utilities to maximize productivity343 points · 126 comments
- May 7, 2019PowerToys – Windows system utilities to maximize productivity82 points · 29 comments
- May 24, 2023PowerToys Release 0.70 with Mouse Without Borders and PowerToys Peek41 points · 12 comments
- May 3, 2025PowerToys – Windows system utilities to maximize productivity10 points · 2 comments
23 more on Hacker News
- Oct 29, 2020Microsoft PowerToys – Color Picker7 points
- Feb 21, 2021PowerToys6 points
- May 8, 2019Microsoft PowerToys for Windows 106 points · 2 comments
- May 21, 2025The Windows efficiency toolkit open-sourced by Microsoft5 points · 1 comment
- Apr 30, 2020Microsoft PowerToys v0.17.05 points
- May 29, 2023A plea to Microsoft: Subpixel text rendering for WRGB stripe and RGB triangular4 points
- Nov 3, 2023Microsoft PowerToys: utilities for tuning and streamlining Windows experience3 points · 1 comment
- Nov 3, 2022Release v0.64.0 · Microsoft/PowerToys3 points
- Jan 10, 2022PowerToys: Utilities to tune and streamline Windows for greater productivity3 points
- Nov 1, 2021Microsoft PowerToys3 points
- Oct 9, 2025PowerToys has detected an app Always On Top message · Issue #309732 points
- Oct 30, 2023PowerToys: Windows system utilities to maximize productivity2 points
- Feb 9, 2023PowerToys Quick Accent adds the ability to type en and em dashes2 points · 1 comment
- Aug 23, 2020Microsoft PowerToys for Windows 102 points · 1 comment
- Aug 2, 2020Microsoft PowerToys2 points
- May 19, 2020PowerToys v0.18.02 points
- Oct 1, 2023Powertoys bug #2701: [New setting] Check for updates automatically (on/off)1 point
- Nov 3, 2022PowerToys: Windows system utilities to maximize productivity1 point
- May 28, 2021MS PowerToys is a set of utilities for power users to tune their Windows 101 point · 1 comment
- Jun 24, 2020PowerToys Keyboard Manager1 point
- May 30, 2020Windows PowerToys Run1 point
- Oct 29, 2019Microsoft Powertoys v0.12.01 point
- May 8, 2019Microsoft Reboots PowerToys for Windows 101 point
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/.github/copilot-instructions.mdCopilot instructions
- powertoys-verificationSkill
- release-note-generationSkill
- ui-tests-local-vmSkill
- ui-tests-migrationSkill
- ui-tests-pipeline-ciSkill
- winmd-api-searchSkill
- add-adaptive-card-formSkill
- add-dock-bandSkill
- add-extension-settingsSkill
- add-fallback-commandsSkill
- publish-extensionSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Update project files, NuGet packages, and signing config
- Distinctive: line 262
Read only the section relevant to your current task:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WPF to WinUI 3 Migration Skill
Migrate PowerToys modules from WPF (System.Windows.*) to WinUI 3 (Microsoft.UI.Xaml.* / Windows App SDK). Based on patterns validated in the ImageResizer module migration.
When to Use This Skill
- Migrate a PowerToys module from WPF to WinUI 3
- Convert WPF XAML files to WinUI 3 XAML
- Replace
System.Windowsnamespaces withMicrosoft.UI.Xaml - Migrate
Dispatcherusage toDispatcherQueue - Migrate custom
Observable/RelayCommandto CommunityToolkit.Mvvm source generators - Replace WPF-UI (Lepo) controls with native WinUI 3 controls
- Convert imaging code from
System.Windows.Media.ImagingtoWindows.Graphics.Imaging - Handle WPF
Windowvs WinUIWindowdifferences (sizing, positioning, SizeToContent) - Migrate resource files from
.resxto.reswwithResourceLoader - Fix installer/build pipeline issues after WinUI 3 migration
- Update project files, NuGet packages, and signing config
Prerequisites
- Visual Studio 2022 17.4+
- Windows App SDK NuGet package (
Microsoft.WindowsAppSDK) - .NET 8+ with
net8.0-windows10.0.19041.0TFM - Windows 10 1803+ (April 2018 Update or newer)
Migration Strategy
Phase-by-Phase Scope
Work on bounded problems, not the entire codebase at once. Each phase should compile before moving to the next.
- Project file — Update TFM, NuGet packages, set
<UseWinUI>true</UseWinUI> - Data models and business logic — No UI dependencies, migrate first
- MVVM framework — Replace custom Observable/RelayCommand with CommunityToolkit.Mvvm
- Resource strings — Migrate
.resx→.resw, introduceResourceLoaderInstance - Services and utilities — Replace
System.Windowstypes, async-ify imaging code - ViewModels — Update Dispatcher usage, binding patterns
- Views/Pages — Starting from leaf pages with fewest dependencies
- Main page / shell — Last, since it depends on everything
- App.xaml / startup code — Merge carefully (do NOT overwrite WinUI 3 boilerplate)
- Installer & build pipeline — Update WiX, signing, build events
- Tests — Adapt for WinUI 3 runtime, async patterns
Migration Contract: Prohibited Patterns
These rules capture human judgment and must be applied consistently across every file. Do NOT deviate.
Architecture prohibitions:
- Do NOT overwrite
App.xaml/App.xaml.cs— WinUI 3 has different lifecycle boilerplate. Merge resources and init code into the generated WinUI 3 App class. - Do NOT create Exe→WinExe
ProjectReference— Extract shared code to a Library project. Causes phantom build artifacts. - Do NOT instantiate services directly — Use DI and CommunityToolkit.Mvvm patterns.
- Do NOT create a
Windowsubclass for every dialog or sub-page — useContentDialogfor in-app dialogs andFrame/Pagenavigation for sub-views. SeparateWindowclasses are reserved for distinct top-level surfaces (e.g., FancyZones editor, OOBE). - Do NOT omit
WindowsPackageType=NoneandWindowsAppSDKSelfContained=true— Both are mandatory in the csproj for every WinUI 3 module in PowerToys. Without them the app crashes at startup withCOMException: ClassFactory cannot supply requested classbecause the WinUI 3 runtime DLLs are not found. - Do NOT default to a bare
Window, and do NOT hand-write code-behind for windowing that XAML can express — For a top-level window in a WinUI 3 module, useWinUIEx.WindowExor an existing PowerToys base derived from it (for example,TransparentWindowfor transient overlays).WindowExrestores WPF-likeWindowmembers as XAML properties (MinWidth/MinHeight,Width/Height,IsResizable,IsMaximizable/IsMinimizable,IsTitleBarVisible,IsAlwaysOnTop,IsShownInSwitchers,WindowState,SystemBackdrop) plus helpers (CenterOnScreen(),PersistenceId), so windowing is declared in XAML instead of manualAppWindow/OverlappedPresentercode-behind. This is the established PowerToys convention across ImageResizer, PowerDisplay, Peek, AdvancedPaste, MeasureTool, ShortcutGuide, Settings, Hosts, FileLocksmith, QuickAccess, and other WinUI 3 modules. Only drop to rawAppWindow/presenter code for behaviorWindowExdoes not expose. See Threading and Window Management → WindowEx.
XAML prohibitions:
- Do NOT use
{DynamicResource}— Replace with{ThemeResource}(theme-reactive) or{StaticResource}. - Do NOT use
{Binding}inSetter.Value— Not supported in WinUI 3. Use{StaticResource}. - Do NOT use
{x:Static}— Replace with{x:Bind},x:Uid, or code-behind. - Do NOT use
{x:Type}— Not supported. Usex:DataTypefor DataTemplate, or code-behind. - Do NOT use
clr-namespace:— Replace withusing:in all xmlns declarations. - Do NOT use
Style.Triggers/DataTrigger/EventTrigger— Replace withVisualStateManager. - Do NOT use
MultiBinding— Replace withx:Bindfunction binding or computed ViewModel property. - Do NOT mechanically port WPF
IValueConverterclasses — Prefer controlVisualStates, direct{x:Bind}Boolean-to-Visibilityconversion, resources supplied byXamlControlsResources, orCommunityToolkit.WinUI.Converters. Reuse converter instances and invert them withConverterParameter=Truewhen supported; write a custom converter only for app-specific conversion logic. See Value Converter Decision Guide. - Do NOT use
Visibility="Hidden"— WinUI only hasVisibleandCollapsed. UseOpacity="0"if layout must be preserved. - Do NOT use
IsDefault/IsCancel— UseAccentButtonStylefor primary button; handle Enter/Escape in code-behind. - Do NOT omit
BasedOnwhen overriding default styles — Without it, your style replaces the entire default. Always useBasedOn="{StaticResource DefaultButtonStyle}"etc. - Do NOT omit
XamlControlsResourcesas first merged dictionary — It provides default Fluent styles. Without it, controls have no visual appearance.
Code-behind prohibitions:
- Do NOT use
Application.Current.Dispatcher— StoreDispatcherQueuein a static field explicitly. - Do NOT use
Window.Current— Not supported. Use a customApp.Windowstatic property. - Do NOT put
DataContext,Resources, orVisualStateManageronWindow— WinUI 3Windowis NOT aDependencyObject. Use a rootPage/UserControl/Grid. - Do NOT use tunneling/preview events (
PreviewMouseDown,PreviewKeyDown) — WinUI has no tunneling. Use bubbling equivalents withHandledproperty orAddHandler(handledEventsToo: true).
Resource prohibitions:
- Do NOT use
Properties.Resources.MyString— Replace withResourceLoaderInstance.ResourceLoader.GetString("MyString"). - Do NOT initialize
ResourceLoader-dependent values as static fields — Wrap inLazy<T>or null-coalescing property. - Do NOT use
pack://URIs — Replace withms-appx:///scheme.
Quick Reference Tables
Namespace Mapping
| WPF | WinUI 3 | Notes |
System.Windows | Microsoft.UI.Xaml | Root namespace |
System.Windows.Controls | Microsoft.UI.Xaml.Controls | Core controls |
System.Windows.Controls.Primitives | Microsoft.UI.Xaml.Controls.Primitives | Low-level primitives |
System.Windows.Media | Microsoft.UI.Xaml.Media | Brushes, transforms |
System.Windows.Media.Animation | Microsoft.UI.Xaml.Media.Animation | Storyboard, animations |
System.Windows.Media.Imaging | Microsoft.UI.Xaml.Media.Imaging (UI) / Windows.Graphics.Imaging (processing) | Split by purpose |
System.Windows.Media.Media3D | No equivalent | Use Win2D or Composition APIs |
System.Windows.Shapes | Microsoft.UI.Xaml.Shapes | Rectangle, Ellipse, Path |
System.Windows.Input | Microsoft.UI.Xaml.Input | Pointer, keyboard, focus |
System.Windows.Data | Microsoft.UI.Xaml.Data | Binding, IValueConverter |
System.Windows.Documents | Microsoft.UI.Xaml.Documents | Limited — RichTextBlock + Paragraph |
System.Windows.Markup | Microsoft.UI.Xaml.Markup | XAML parsing, markup extensions |
System.Windows.Automation | Microsoft.UI.Xaml.Automation | Accessibility / UI Automation |
System.Windows.Navigation | No direct equivalent | Use Frame.Navigate() |
System.Windows.Threading | Microsoft.UI.Dispatching | Dispatcher → DispatcherQueue |
System.Windows.Interop | WinRT.Interop / Microsoft.UI.Xaml.Hosting | HWND interop |
Control Replacements (No 1:1 Mapping)
These WPF controls have no direct counterpart and require a different control or third-party package:
| WPF Control | WinUI 3 Replacement | Notes |
DataGrid | WinUI.TableView | Community library; the Toolkit DataGrid is no longer maintained. Legacy code may still pin v7 CommunityToolkit.WinUI.UI.Controls.DataGrid 7.1.2 |
Ribbon | CommandBar / NavigationView, or Toolkit Labs Ribbon | No first-party Ribbon in WinUI; Labs component is experimental/partial |
Menu / MenuItem | MenuBar / MenuBarItem / MenuFlyout | MenuBar for classic menu, MenuFlyout for context |
ContextMenu | MenuFlyout | Assign to ContextFlyout property |
ToolBar / ToolBarTray | CommandBar + AppBarButton | |
StatusBar | Custom Grid/StackPanel or InfoBar | No StatusBar control |
TabControl | TabView or NavigationView (top mode) | TabView for closeable tabs |
DocumentViewer | WebView2 | Render PDFs/XPS inside WebView2 |
FlowDocument | RichTextBlock | Partial replacement only |
RichTextBox | RichEditBox | Rich text editing |
GroupBox | Expander (built-in) or HeaderedContentControl (Toolkit) | See Layout & Header Controls from CommunityToolkit.WinUI below |
Label | TextBlock | WPF Label is a ContentControl; use TextBlock + AccessKey |
TreeView | TreeView (native) | Available natively, but data binding model differs significantly |
MessageBox | ContentDialog | Must set XamlRoot before ShowAsync() |
MediaElement | MediaPlayerElement | Different API |
AccessText | Not available | Use AccessKey property on target control |
Layout & Header Controls from CommunityToolkit.WinUI
These WPF controls have no built-in WinUI 3 equivalent — install the corresponding CommunityToolkit package. The NuGet package id and the XAML namespace differ intentionally: package names end in .Primitives / .HeaderedControls, but the registered XAML namespace is the shorter CommunityToolkit.WinUI.Controls (confirmed in the official Microsoft Q&A).
| WPF Control | WinUI 3 Replacement | NuGet Package | XAML Namespace |
WrapPanel | WrapPanel | CommunityToolkit.WinUI.Controls.Primitives | using:CommunityToolkit.WinUI.Controls |
UniformGrid | UniformGrid | CommunityToolkit.WinUI.Controls.Primitives | using:CommunityToolkit.WinUI.Controls |
DockPanel | DockPanel | CommunityToolkit.WinUI.Controls.Primitives | using:CommunityToolkit.WinUI.Controls |
GroupBox (alt.) | HeaderedContentControl | CommunityToolkit.WinUI.Controls.HeaderedControls | using:CommunityToolkit.WinUI.Controls |
No Equivalent — Requires Architectural Rework
These WPF features have no WinUI counterpart and require redesign, not find-and-replace:
| WPF Feature | WinUI 3 Replacement Strategy |
Style.Triggers / DataTrigger | VisualStateManager with StateTrigger — see XAML Migration |
MultiBinding | x:Bind function binding: {x:Bind local:Converters.Format(VM.A, VM.B), Mode=OneWay} |
RoutedUICommand / CommandBinding | ICommand / [RelayCommand] from CommunityToolkit.Mvvm. WinUI also has StandardUICommand / XamlUICommand for platform commands. |
AdornerLayer / Adorner | Depends on use case: TeachingTip/InfoBar (validation), Popup (overlays), PlaceholderText (watermarks), Canvas overlay (decorations) |
Visibility.Hidden | Opacity="0" with Visibility="Visible" (preserves layout space) |
Window.Resources / Window.DataContext | Move to root Grid.Resources / root Page/UserControl — WinUI Window is NOT a DependencyObject |
Tunneling events (Preview*) | Use bubbling equivalents + Handled property or AddHandler(handledEventsToo: true) |
Critical API Replacements
| WPF | WinUI 3 | Notes |
Dispatcher.Invoke() | DispatcherQueue.TryEnqueue() | Different return type (bool), async by default |
Dispatcher.CheckAccess() | DispatcherQueue.HasThreadAccess | Property vs method |
Application.Current.Dispatcher | Store DispatcherQueue in static field | See Threading |
Window.Current | Custom App.Window static property | Not supported in Windows App SDK |
Application.Current.MainWindow | Custom App.Window static property | Must track manually |
MessageBox.Show() | ContentDialog | Must set XamlRoot |
System.Windows.Clipboard | Windows.ApplicationModel.DataTransfer.Clipboard | Different API surface |
RoutedUICommand / CommandBinding | ICommand / [RelayCommand] | Remove CommandBinding; bind ICommand directly |
Properties.Resources.MyString | ResourceLoaderInstance.ResourceLoader.GetString("MyString") | Lazy-init pattern |
DynamicResource | ThemeResource | Theme-reactive only |
clr-namespace: | using: | XAML namespace prefix |
{x:Static props:Resources.Key} | x:Uid or ResourceLoader.GetString() | .resx → .resw |
DataType="{x:Type m:Foo}" | x:DataType="m:Foo" | x:Type not supported |
SizeToContent="Height" | Custom SizeToContent() via AppWindow.Resize() | See Windowing |
Pack URI (pack://...) | ms-appx:/// | Resource URI scheme |
Observable (custom base) | ObservableObject + [ObservableProperty] | CommunityToolkit.Mvvm |
RelayCommand (custom) | [RelayCommand] source generator | CommunityToolkit.Mvvm |
JpegBitmapEncoder | BitmapEncoder.CreateAsync(JpegEncoderId, stream) | Async, unified API |
encoder.QualityLevel = 85 | BitmapPropertySet { "ImageQuality", 0.85f } | int 1-100 → float 0-1 |
Event Replacements (Mouse → Pointer)
| WPF Event | WinUI 3 Event | Notes |
MouseLeftButtonDown | PointerPressed | Check IsLeftButtonPressed on args |
MouseLeftButtonUp | PointerReleased | Check pointer properties |
MouseRightButtonDown | RightTapped | Or PointerPressed with right button check |
MouseMove | PointerMoved | MouseEventArgs → PointerRoutedEventArgs |
MouseWheel | PointerWheelChanged | Different event args |
MouseEnter / MouseLeave | PointerEntered / PointerExited | |
MouseDoubleClick | DoubleTapped | Different event args |
PreviewMouseDown | PointerPressed | No tunneling — use Handled or AddHandler |
PreviewKeyDown | KeyDown | KeyEventArgs → KeyRoutedEventArgs |
Property Replacements
| WPF | WinUI 3 | Context |
Visibility.Hidden | Visibility.Collapsed or Opacity="0" | Use Opacity="0" to preserve layout |
TextWrapping.WrapWithOverflow | TextWrapping.Wrap | WinUI doesn't distinguish |
Focusable="True" | IsTabStop="True" | Different property name |
ContextMenu= | ContextFlyout= | On any UIElement |
MediaElement | MediaPlayerElement | Different API |
SnapsToDevicePixels | Not available | WinUI handles pixel snapping internally |
NuGet Package Migration
| WPF | WinUI 3 | Notes |
Microsoft.Xaml.Behaviors.Wpf | Microsoft.Xaml.Behaviors.WinUI.Managed | |
WPF-UI (Lepo) | Remove — use native WinUI 3 controls | |
CommunityToolkit.Mvvm | CommunityToolkit.Mvvm (same) | |
Microsoft.Toolkit.Wpf.* | CommunityToolkit.WinUI.* | |
| (none) | Microsoft.WindowsAppSDK | Required |
| (none) | Microsoft.Windows.SDK.BuildTools | Required |
| (none) | WinUIEx | Recommended for top-level windows in WinUI 3 modules — add <PackageReference Include="WinUIEx" /> (the version is centrally managed), then use WindowEx or an existing PowerToys base derived from it. It exposes WPF-like window properties in XAML (size, min/max, resizable, title-bar visibility, backdrop, always-on-top) plus CenterOnScreen()/PersistenceId; prefer it over bare Window and manual AppWindow code-behind |
| (none) | CommunityToolkit.WinUI.Converters | Optional |
| (none) | CommunityToolkit.WinUI.Controls.Primitives | Optional — WrapPanel, UniformGrid, DockPanel, ConstrainedBox |
| (none) | CommunityToolkit.WinUI.Controls.HeaderedControls | Optional — HeaderedContentControl, HeaderedItemsControl, HeaderedTreeView |
| (none) | CommunityToolkit.WinUI.Controls.SettingsControls | Optional — SettingsCard, SettingsExpander |
| (none) | CommunityToolkit.WinUI.Controls.Sizers | Optional — GridSplitter |
| (none) | CommunityToolkit.WinUI.UI.Controls.DataGrid | Legacy v7 — only for migrating existing DataGrid code; prefer WinUI.TableView |
XAML Syntax Changes
| WPF | WinUI 3 | Notes |
xmlns:local="clr-namespace:MyApp" | xmlns:local="using:MyApp" | CLR → using syntax |
{DynamicResource Key} | {ThemeResource Key} | Re-evaluates on theme change |
{StaticResource Key} | {StaticResource Key} | Same — resolved once at load |
{x:Static Type.Member} | {x:Bind} or code-behind | |
{x:Type local:MyType} | Not supported | Use x:DataType for DataTemplate |
{x:Array} | Not supported | Create collections in code-behind |
<Style.Triggers> / <DataTrigger> | VisualStateManager | See XAML Migration |
{Binding} in Setter.Value | Not supported — use StaticResource | |
Content="{x:Static p:Resources.Cancel}" | x:Uid="Cancel" with .Content in .resw | |
sys:String / sys:Int32 / etc. | x:String / x:Int32 / etc. | XAML intrinsic types |
<ui:FluentWindow> (WPF-UI) | <Window> | Native + ExtendsContentIntoTitleBar |
<ui:NumberBox> / <ui:ProgressRing> (WPF-UI) | Native <NumberBox> / <ProgressRing> | |
BasedOn="{StaticResource {x:Type ui:Button}}" | BasedOn="{StaticResource DefaultButtonStyle}" | Named style keys |
IsDefault="True" / IsCancel="True" | Style="{StaticResource AccentButtonStyle}" / KeyDown | |
<AccessText> | Not available — use AccessKey property | |
<behaviors:Interaction.Triggers> | Code-behind or WinUI behaviors | |
Window.Resources | Root container's Resources (e.g. Grid.Resources) | Window is not a DependencyObject |
Binding: {Binding} vs {x:Bind}
Both work in WinUI 3. Prefer {x:Bind} for new/migrated code.
| Feature | {Binding} | {x:Bind} |
| Default mode | OneWay | OneTime — add Mode=OneWay explicitly! |
| Default source | DataContext | Page/UserControl code-behind |
| Compile-time validation | No | Yes |
| Function binding | No | Yes (replaces MultiBinding) |
| Performance | Reflection-based | Compiled, no reflection |
MultiBinding support | No (not in WinUI) | Use function binding |
Detailed Reference Docs
Read only the section relevant to your current task:
- Namespace and API Mapping — Full type mapping, NuGet changes, project file, CsWinRT interop
- XAML Migration Guide — XAML syntax, WPF-UI removal, markup extensions, styles, resources, data binding
- Threading and Window Management — Dispatcher, DispatcherQueue, SizeToContent, AppWindow, HWND interop, custom entry point
- Imaging API Migration — BitmapEncoder/Decoder, SoftwareBitmap, CodecHelper, async patterns, int→uint
- PowerToys-Specific Patterns — MVVM migration, ResourceLoader, Lazy init, installer, signing, test adaptation, build pipeline
Common Pitfalls (from ImageResizer migration)
| Pitfall | Solution |
ContentDialog throws "does not have a XamlRoot" | Set dialog.XamlRoot = this.Content.XamlRoot before ShowAsync() |
FilePicker throws error in desktop app | Call WinRT.Interop.InitializeWithWindow.Initialize(picker, hwnd) |
Window.Dispatcher returns null | Use Window.DispatcherQueue instead |
Resources on Window element not found | Move resources to root layout container (Grid.Resources) |
VisualStateManager on Window fails | Use UserControl or Page inside the Window |
Satellite assembly installer errors (WIX0103) | Remove .resources.dll refs from Resources.wxs; WinUI 3 uses .pri |
Phantom .exe/.deps.json in root output dir | Avoid Exe→WinExe ProjectReference; use Library project |
ResourceLoader crash at static init | Wrap in Lazy<T> or null-coalescing property — see Lazy Init |
SizeToContent not available | Implement manual content measurement + AppWindow.Resize() with DPI scaling |
x:Bind default mode is OneTime | Explicitly set Mode=OneWay or Mode=TwoWay |
DynamicResource / x:Static not compiling | Replace with ThemeResource / ResourceLoader or x:Uid |
IValueConverter.Convert signature mismatch | Last param: CultureInfo → string (language tag) |
| Test project can't resolve WPF types | Add <UseWPF>true</UseWPF> temporarily; remove after imaging migration |
Pixel dimension type mismatch (int vs uint) | WinRT uses uint for pixel sizes — add u suffix in test assertions |
$(SolutionDir) empty in standalone project build | Use $(MSBuildThisFileDirectory) with relative paths instead |
| JPEG quality value wrong after migration | WPF: int 1-100; WinRT: float 0.0-1.0 |
| MSIX packaging fails in PreBuildEvent | Move to PostBuildEvent; artifacts not ready at PreBuild time |
| RC file icon path with forward slashes | Use double-backslash escaping: ..\\ui\\Assets\\icon.ico |
COMException: ClassFactory cannot supply requested class at startup | Missing <WindowsPackageType>None</WindowsPackageType> and/or <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> in csproj. Without these, the app tries to locate the Windows App SDK framework package (not installed) instead of using bundled runtime DLLs. Both properties are mandatory for every WinUI 3 module in PowerToys. |
CombinedGeometry not available in WinUI 3 | WinUI 3 UIElement.Clip only accepts RectangleGeometry. For overlay hole effects (exclude region), use a Path element with GeometryGroup FillRule="EvenOdd" containing two RectangleGeometry children — the EvenOdd rule creates a transparent hole where geometries overlap. |
Troubleshooting
| Issue | Solution |
| Build fails after namespace rename | Check for lingering System.Windows usings; some types have no direct equivalent |
Missing PresentationCore.dll at runtime | Ensure ALL imaging code uses Windows.Graphics.Imaging, not System.Windows.Media.Imaging |
DataContext not working on Window | WinUI 3 Window is not a DependencyObject; use a root Page or UserControl |
| XAML designer not available | WinUI 3 does not support XAML Designer; use Hot Reload instead |
| NuGet restore failures | Run build-essentials.cmd after adding Microsoft.WindowsAppSDK package |
Parallel.ForEach compilation error | Migrate to Parallel.ForEachAsync for async imaging operations |
| Signing check fails on leaked artifacts | Run generateAllFileComponents.ps1; verify only WinUI3Apps\\ paths in signing config |
COMException / ClassFactory error at app launch | Ensure csproj has <WindowsPackageType>None</WindowsPackageType> and <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>. These are required for all unpackaged WinUI 3 apps in PowerToys — without them the WinUI 3 COM runtime cannot be found. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

