WinUI-Gallery
Copilot instructions3.7k starsChanged 2 months agoMITView on GitHub
Solution: Open WinUIGallery.slnx in Visual Studio 2022+. Set WinUIGallery as the startup project. Build configurations: Debug, Release, Preview, Stable, Store, Sideload, Debug-Unpackaged. Platforms: x86, x64, ARM64. This is a WinUI 3 / Windows App SDK gallery app that demonstrates controls, styles, and design patterns. It is a companion to the Fluent Design guidelines. Each control demo lives in its own folder under Samples/{UniqueId}/ (e.g., Samples/Button/, Samples/CheckBox/). The folder name must match the control's UniqueId from ControlInfoData.json — this convention is…
Trending
Quiet since September.about the whole repository
Who's talking about microsoft/WinUI-Gallery
- microsoft/microsoft-ui-xaml“WPF Gap: CollectionViewSource doesn't support all WPF scenarios”GitHub · Feb 23, 2021 · 19 reactions
- dotnet/maui“[Feature Request] New Navigation Bar to Mimic win ui Behavour In Shell”GitHub · May 19, 2022 · 9 reactions
- microsoft/microsoft-ui-xaml“Set default window icon from host executable during window creation”GitHub · Apr 3, 2026 · 6 reactions
- microsoft/microsoft-ui-xaml“Menubar behavior regression – Breaks cross platform dropdown conventions”GitHub · Oct 7, 2023 · 5 reactions
- dotnet/maui“[Windows] Fix runtime theme update for controls and TitleBar”GitHub · Sep 22, 2025 · 4 reactions
The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 22
Talked about on GitHub (22 times).
On GitHub · 22
- Feb 23, 2021WPF Gap: CollectionViewSource doesn't support all WPF scenarios — microsoft/microsoft-ui-xaml19 reactions · 10 comments
- May 19, 2022[Feature Request] New Navigation Bar to Mimic win ui Behavour In Shell — dotnet/maui9 reactions · 4 comments
- Apr 3, 2026Set default window icon from host executable during window creation — microsoft/microsoft-ui-xaml6 reactions · 2 comments
- Oct 7, 2023Menubar behavior regression – Breaks cross platform dropdown conventions — microsoft/microsoft-ui-xaml5 reactions · 5 comments
- Sep 22, 2025[Windows] Fix runtime theme update for controls and TitleBar — dotnet/maui4 reactions · 24 comments
17 more on GitHub
- Oct 20, 2024Please add pickers support — microsoft/WindowsAppSDK4 reactions · 3 comments
- Apr 10, 2024Rejuvenate visuals to match current WinUI gallery — microsoft/react-native-gallery2 reactions · 6 comments
- Sep 29, 2026[Feature]: TokenViewSelectorBarStyle — ghost1372/DevWinUI1 reaction · 2 comments
- Dec 31, 2025Enable navigation cache model in C++/WinRT will lead to app close exception — microsoft/microsoft-ui-xaml1 reaction
- Jul 28, 2023Wrong mouse cursor on startup — microsoft/microsoft-ui-xaml1 reaction · 1 comment
- Sep 21, 2022GridView doesn't apply correct style when IsEnabled is initialized as false — microsoft/microsoft-ui-xaml1 reaction · 1 comment
- Aug 27, 2026Crash when PipsPager and FlipView are bound to same ObservableCollection and deleting 2 or more items — niels9001/microsoft-ui-xaml0 reactions
- Aug 9, 2026Crash when PipsPager and FlipView are bound to same ObservableCollection and deleting 2 or more items — microsoft/microsoft-ui-xaml0 reactions
- Mar 11, 2026[KeyboardManager][Known issue] Icon not appearing in title bar and task bar — microsoft/PowerToys0 reactions
- Mar 11, 2026Correctly configured icon fails in Store release — microsoft/microsoft-ui-xaml0 reactions
- Oct 9, 2025BlockedSite icon not available on all platforms? — MicrosoftDocs/windows-dev-docs0 reactions · 2 comments
- Mar 10, 2025Subtle Blurriness in `StackPanel` Inside `ScrollView` or `ScrollViewer` When Maximized — microsoft/microsoft-ui-xaml0 reactions
- Nov 10, 2023Unpackaged mode doesn't work for app created by VSIX — microsoft/microsoft-ui-xaml0 reactions
- Aug 25, 2023File Picker — microsoft/TemplateStudio0 reactions
- Nov 11, 2022Bump Microsoft.WindowsAppSDK from 1.1.5 to 1.2.221109.1 — matt-goldman/maui0 reactions · 3 comments
- Nov 11, 2022Bump Microsoft.WindowsAppSDK from 1.1.5 to 1.2.221109.1 — rookiejava/maui0 reactions · 3 comments
- Nov 11, 2022Bump Microsoft.WindowsAppSDK from 1.1.5 to 1.2.221109.1 — kokizzu/maui0 reactions · 3 comments
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this copilot-instructions.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 72
Add the control entry to SampleSupport/Data/ControlInfoData.json with a unique UniqueId matching the page class name (without Page suffix).
- Very specific: line 73
Create a folder Samples/{UniqueId}/ and add {ControlName}Page.xaml and .xaml.cs using the ControlExample pattern above.
- Very specific: line 75
Add any code snippets as .txt files in the same Samples/{UniqueId}/ folder.
- Distinctive: line 86
All new UI must be accessible.
- Very specific: line 97
When looking up API references, control usage, or platform guidance, use the Microsoft Learn MCP server at …
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot Instructions for WinUI Gallery
Build and Test
Solution: Open WinUIGallery.slnx in Visual Studio 2022+. Set WinUIGallery as the startup project.
# Restore and build
dotnet restore WinUIGallery.slnx
msbuild WinUIGallery.slnx /p:Configuration=Debug /p:Platform=x64
# Run unit tests
dotnet test tests\WinUIGallery.UnitTests\WinUIGallery.UnitTests.csproj
# Run a single unit test
dotnet test tests\WinUIGallery.UnitTests\WinUIGallery.UnitTests.csproj --filter "FullyQualifiedName~TestMethodName"
# UI tests require the app to be running; use Appium + WinAppDriver
dotnet test tests\WinUIGallery.UITests\WinUIGallery.UITests.csprojBuild configurations: Debug, Release, Preview, Stable, Store, Sideload, Debug-Unpackaged. Platforms: x86, x64, ARM64.
Architecture
This is a WinUI 3 / Windows App SDK gallery app that demonstrates controls, styles, and design patterns. It is a companion to the Fluent Design guidelines.
Project structure
- WinUIGallery — Main app (XAML + C#, .NET 10,
net10.0-windows10.0.22621.0) - WinUIGallery.SourceGenerator — Incremental source generator that reads
ControlInfoData.jsonat compile time and emitsSamplesNavigationPageMappings.csto map control IDs → page types - tests/WinUIGallery.UnitTests — MSTest v3 unit tests (runs in WinUI context)
- tests/WinUIGallery.UITests — MSTest + Appium UI automation tests with Axe.Windows accessibility checks
Data flow
Samples/Data/ControlInfoData.jsondefines all control entries grouped by category (Fundamentals, Design, Accessibility, etc.). Each item hasUniqueId,Title,Description,Docs,IsNew/IsUpdated/IsPreviewflags.- The source generator reads this JSON at build time and generates a mapping from
UniqueId→ XAML page type (e.g.,"Button"→typeof(ButtonPage)). - At runtime,
ControlInfoDataSourceloads and deserializes the JSON, then uses the generated mappings to wire up navigation. App.xaml.csinitializes data sources, populates NavigationView, and handles protocol activation for deep-linking to specific controls.
Control pages
Each control demo lives in its own folder under Samples/{UniqueId}/ (e.g., Samples/Button/, Samples/CheckBox/). The folder name must match the control's UniqueId from ControlInfoData.json — this convention is used to generate GitHub source links and resolve sample code files at runtime. Each folder contains:
{ControlName}Page.xaml+.xaml.cs— the control demo page*.txt— XAML/C# code snippets displayed in the gallery UI
Pages use the ControlExample custom control to show interactive demos:
<controls:ControlExample HeaderText="A basic button">
<controls:ControlExample.Example>
<Button Content="Click me" Click="Button_Click" />
</controls:ControlExample.Example>
<controls:ControlExample.Options>
<CheckBox Content="Toggle something" />
</controls:ControlExample.Options>
<controls:ControlExample.Xaml>
<x:String>$(XamlSnippet)</x:String>
</controls:ControlExample.Xaml>
<controls:ControlExample.Substitutions>
<controls:ControlExampleSubstitution Key="XamlSnippet" Value="{x:Bind ...}" />
</controls:ControlExample.Substitutions>
</controls:ControlExample>ControlExample exposes: Example, Output, Options, Xaml/XamlSource, CSharp/CSharpSource, and Substitutions for dynamic $(Key) replacements in displayed code.
Adding a New Control Page
- Add the control entry to
SampleSupport/Data/ControlInfoData.jsonwith a uniqueUniqueIdmatching the page class name (withoutPagesuffix). - Create a folder
Samples/{UniqueId}/and add{ControlName}Page.xamland.xaml.csusing theControlExamplepattern above. The folder name must match theUniqueIdexactly. - The source generator auto-maps the
UniqueIdto the page type — no manual registration needed. - Add any code snippets as
.txtfiles in the sameSamples/{UniqueId}/folder. They are automatically included in the build as content. - Regenerate the sample index and commit the result:
dotnet run --project tools/CatalogExporter -- generatecatalog/windows-samples.json is a checked-in file that other tools consume, and CI fails if it does not match the current samples. Run this whenever you add, rename, remove, or edit a control page or a snippet .txt.
Accessibility
All new UI must be accessible. The project enforces this through automated Axe.Windows scans that run against every control page in the UI test suite.
- Set
AutomationProperties.Nameon all interactive controls (buttons, text boxes, sliders, toggles) so screen readers can announce them. - Use
AutomationProperties.HeadingLevel(Level2,Level3) on section headers for semantic navigation. - Hide decorative elements from the accessibility tree with
AutomationProperties.AccessibilityView="Raw". - Support keyboard navigation — ensure all interactive elements are reachable via Tab and operable via Enter/Space.
- Meet WCAG color contrast requirements — the gallery includes a color contrast checker page as a reference.
- New control pages are automatically picked up by
AxeScanAllTestswhich navigates to every page and asserts zero accessibility violations.
Documentation Reference
When looking up API references, control usage, or platform guidance, use the Microsoft Learn MCP server at https://learn.microsoft.com/en-us/training/support/mcp. This covers all Windows developer documentation. This project is WinUI 3 / Windows App SDK — always prefer WinUI 3 docs over WPF, MAUI, or UWP equivalents.
Key reference repositories:
- microsoft/microsoft-ui-xaml — WinUI 3 source code (controls, theming, input handling)
- microsoft/WindowsAppSDK — Windows App SDK (app lifecycle, windowing, deployment)
- microsoft/WindowsAppSDK-Samples — Official samples demonstrating Windows App SDK features
- microsoft/ai-dev-gallery — AI Dev Gallery, a WinUI 3 app showcasing on-device AI models and APIs
Conventions
- File-scoped namespaces are enforced (
csharp_style_namespace_declarations = file_scoped, severity: warning). - File headers are required:
// Copyright (c) Microsoft Corporation. All rights reserved./// Licensed under the MIT License. - No
varfor built-in types — use explicit types (csharp_style_var_for_built_in_types = false). - No
this.qualifier — access members directly withoutthis.. - Allman brace style — opening braces on their own line (
csharp_new_line_before_open_brace = all). - 4-space indentation, CRLF line endings, no final newline.
- Pattern matching preferred over
as/iswith null checks. - Accessibility modifiers required on all non-interface members.
- PascalCase for types, methods, and properties. Interfaces prefixed with
I. - JSON serialization uses
System.Text.Jsonwith source generators ([JsonSerializable]), not Newtonsoft. - XAML namespaces:
xmlns:controls="using:WinUIGallery.Controls"for custom controls. - Pages inherit from
ItemsPageBase(which implementsINotifyPropertyChanged) when they need data binding to control info items.
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.

