Skip to content

WinUI 3 Expert#863

Closed
niels9001 wants to merge 7 commits intogithub:stagedfrom
niels9001:niels9001/winui3-expert
Closed

WinUI 3 Expert#863
niels9001 wants to merge 7 commits intogithub:stagedfrom
niels9001:niels9001/winui3-expert

Conversation

@niels9001
Copy link
Contributor

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • My contribution adds a new instruction, prompt, agent, skill, or workflow file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, or workflow with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.

Description

Adds a comprehensive WinUI 3 / Windows App SDK development toolkit — an agent, instruction set, skill, and plugin — to help developers build high-quality desktop Windows apps with correct, modern APIs.

The problem: AI coding assistants frequently generate incorrect WinUI 3 code by using legacy UWP APIs that dominate training data. The top risks are ContentDialog without XamlRoot, MessageDialog instead of ContentDialog, and CoreDispatcher instead of DispatcherQueue, among many others.

What's included:

  • agents/winui3-expert.agent.md — Expert agent covering UWP to WinUI 3 API migration rules, Fluent Design UX best practices, MVVM patterns, windowing, threading, app lifecycle, dialogs/pickers, control selection guide, error handling, NuGet ecosystem (CommunityToolkit, WinUIEx), resource management, and deployment.
  • instructions/winui3.instructions.md — Instruction set applied to XAML, C#, and csproj files with 14 NEVER use rules for legacy UWP APIs, plus typography, theming, spacing, materials, motion, control selection, error handling, and localization rules.
  • skills/winui3-migration-guide/SKILL.md — Migration-focused skill with UWP to WinUI 3 namespace mapping table, top 3 Copilot mistakes with before/after code snippets, and a 14-step migration checklist.
  • plugins/winui3-development/ — Installable plugin bundling the agent and skill for easy discovery and installation.

Sources: WinUI Gallery copilot instructions, Windows App SDK migration guides, and documented common Copilot code generation pitfalls.


By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

github-actions bot and others added 5 commits March 3, 2026 04:36
- Expanded Testing section in agent with Unit Test App project setup,
  [TestMethod] vs [UITestMethod] attributes, and code examples
- Added Testing rules to instructions file
- Added Testing Migration section to migration guide skill with
  UWP-to-WinUI 3 test project mapping and updated checklist

Reference: https://learn.microsoft.com/en-us/windows/apps/winui/winui3/testing/create-winui-unit-test-project

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@niels9001 niels9001 marked this pull request as ready for review March 3, 2026 16:50
@niels9001 niels9001 requested a review from aaronpowell as a code owner March 3, 2026 16:50
Copilot AI review requested due to automatic review settings March 3, 2026 16:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a WinUI 3 / Windows App SDK toolkit (agent + instructions + migration skill + plugin) to help prevent Copilot-generated UWP/legacy API usage and guide correct WinUI 3 desktop patterns.

Changes:

  • Added a WinUI 3 migration skill with common pitfalls, API mappings, and a migration checklist.
  • Added a WinUI 3 expert agent and WinUI 3 coding instructions (XAML/C#/csproj).
  • Added a winui3-development plugin plus docs/marketplace entries for discoverability.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skills/winui3-migration-guide/SKILL.md New WinUI 3 migration reference skill with examples, mappings, and checklist
plugins/winui3-development/README.md Plugin README describing installation and included capabilities
plugins/winui3-development/.github/plugin/plugin.json New plugin manifest bundling the agent + migration skill
instructions/winui3.instructions.md New instruction set applied to XAML/C#/csproj for WinUI 3 guidance
docs/README.skills.md Adds the new skill to the skills index
docs/README.plugins.md Adds the new plugin to the plugins index
docs/README.instructions.md Adds the new instructions file to the instructions index
docs/README.agents.md Adds the new agent to the agents index
.github/plugin/marketplace.json Adds the new plugin to marketplace metadata

Comment on lines +118 to +120
- Use a **4px grid system**: all margins, padding, and spacing values must be multiples of 4 epx.
- Standard spacing: 4 (compact), 8 (controls), 12 (small gutters), 16 (content padding), 24 (large gutters).
- Prefer `Grid` over deeply nested `StackPanel` chains for performance.
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing guidance mixes units/terminology: it says “4px grid system” but then uses “epx” (and later “Cards: 4–8 epx”, etc.). Since XAML uses unitless effective pixels in markup, consider using a single consistent term (typically “px”) or define what “epx” means to avoid confusing readers.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback Remove epx and use use px

Comment on lines +248 to +255
All `GetForCurrentView()` patterns are unavailable in WinUI 3 desktop apps:

| UWP API | WinUI 3 Replacement |
|---------|-------------------|
| `UIViewSettings.GetForCurrentView()` | Use `AppWindow` properties |
| `ApplicationView.GetForCurrentView()` | `AppWindow.GetFromWindowId(windowId)` |
| `DisplayInformation.GetForCurrentView()` | Win32 `GetDpiForWindow()` or `XamlRoot.RasterizationScale` |
| `CoreApplication.GetCurrentView()` | Not available — track windows manually |
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement “All GetForCurrentView() patterns are unavailable in WinUI 3 desktop apps” is overly broad and conflicts with the agent content later showing ConnectedAnimationService.GetForCurrentView() usage. Consider narrowing this section to the specific UWP system APIs that are missing (e.g., ApplicationView, UIViewSettings, DisplayInformation, etc.) so readers don’t interpret it as “never call any method named GetForCurrentView”.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback Remove the connectedanimations stuff

niels9001 and others added 2 commits March 3, 2026 19:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@niels9001 niels9001 closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants