agentleFS
MicrosoftKnown publishermicrosoft/WinUI-Gallery/.github/copilot-instructions.md

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

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 1 mentionMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 2 mentionsSep 2026: 1 mentionOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/WinUI-Gallery repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/WinUI-Gallery

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

17 more on GitHub
  • In this repositoryOne other file it gives its agents.

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
  1. Very specific:

    Add the control entry to SampleSupport/Data/ControlInfoData.json with a unique UniqueId matching the page class name (without Page suffix).

    line 72
  2. Very specific:

    Create a folder Samples/{UniqueId}/ and add {ControlName}Page.xaml and .xaml.cs using the ControlExample pattern above.

    line 73
  3. Very specific:

    Add any code snippets as .txt files in the same Samples/{UniqueId}/ folder.

    line 75
  4. Distinctive:

    All new UI must be accessible.

    line 86
  5. Very specific:

    When looking up API references, control usage, or platform guidance, use the Microsoft Learn MCP server at …

    line 97

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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.csproj

Build 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.json at compile time and emits SamplesNavigationPageMappings.cs to 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

  1. Samples/Data/ControlInfoData.json defines all control entries grouped by category (Fundamentals, Design, Accessibility, etc.). Each item has UniqueId, Title, Description, Docs, IsNew/IsUpdated/IsPreview flags.
  2. The source generator reads this JSON at build time and generates a mapping from UniqueId → XAML page type (e.g., "Button" → typeof(ButtonPage)).
  3. At runtime, ControlInfoDataSource loads and deserializes the JSON, then uses the generated mappings to wire up navigation.
  4. App.xaml.cs initializes 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

  1. Add the control entry to SampleSupport/Data/ControlInfoData.json with a unique UniqueId matching the page class name (without Page suffix).
  2. Create a folder Samples/{UniqueId}/ and add {ControlName}Page.xaml and .xaml.cs using the ControlExample pattern above. The folder name must match the UniqueId exactly.
  3. The source generator auto-maps the UniqueId to the page type — no manual registration needed.
  4. Add any code snippets as .txt files in the same Samples/{UniqueId}/ folder. They are automatically included in the build as content.
  5. Regenerate the sample index and commit the result:
dotnet run --project tools/CatalogExporter -- generate

catalog/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.Name on 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 AxeScanAllTests which 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:

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 var for built-in types — use explicit types (csharp_style_var_for_built_in_types = false).
  • No this. qualifier — access members directly without this..
  • 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/is with 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.Json with source generators ([JsonSerializable]), not Newtonsoft.
  • XAML namespaces: xmlns:controls="using:WinUIGallery.Controls" for custom controls.
  • Pages inherit from ItemsPageBase (which implements INotifyPropertyChanged) when they need data binding to control info items.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.