How microsoft/winui-gallery works
Project type and purpose
• This is a single‐solution, desktop “sample gallery” application for WinUI 3 and the Windows App SDK.
• Its goal is to demonstrate every WinUI control, style, adaptive layout, design guideline, accessibility feature, and sample code snippet in a navigable UI shell.
File structure
• Top‐level solution (WinUIGallery.sln) contains:
• ▶ WinUIGallery – the main app project (XAML pages, controls, assets, helpers, models, layouts, converters, styles, sample data/code)
• ▶ WinUIGallery.DesktopWap.Package – packaging project (appx manifests)
• ▶ tests/WinUIGallery.UnitTests – unit tests targeting core logic
• ▶ tests/WinUIGallery.UITests – UI automation tests
• There’s also a Tools folder (PowerShell scripts to sync samples), CI pipeline definitions (.pipelines/azure-pipelines.yml), and docs.
README insights
• Confirms it’s purely a client‐side WinUI 3 app.
• Emphasizes use of the Microsoft.UI.Xaml NuGet package, adaptive UI, design & accessibility guidance, and sample‐code loading.
Main components & their relationships
a. Presentation Layer (blue):
• App.xaml + App.xaml.cs (entry point)
• NavigationRootPage → NavigationView shell
• Pages/ (HomePage, AllControlsPage, SectionPage, ItemPage, SettingsPage, plus many sample pages)
• Controls/ (custom user controls and control examples)
b. View/Logic Layer (green):
• Helpers/ (navigation, suspension, theme, file loading, native interop)
• Converters/ (value converters for binding)
• Layouts/ (custom panel & layout logic)
• Models/ (Category, ControlInfoData, IconData)
c. Data Layer (orange):
• FileLoader (loads JSON into model objects)
• Samples/SampleCode (text snippets loaded on demand)
• Samples/SampleHelpers (code support for 3D scenes)
d. Packaging & Infrastructure (gray):
• WinUIGallery.DesktopWap.Package (appx manifests & packaging targets)
• Directory.Build.props/targets, common.props, net7.override.targets
• NuGet.config (WinUI and WindowsAppSDK feed)
• Azure Pipelines definitions (.pipelines/)
e. Test Harnesses (purple):
• UnitTests project (exercises Models, Helpers, Converters)
• UITests project (launches the packaged app via WinAppDriver or Appium, drives UI controls, verifies accessibility via AxeHelper)
Architectural patterns & design principles
• Layered architecture within a single process.
• XAML + code‐behind as “MVVM‐lite” (Views in XAML, logic in code‐behind or Helpers).
• Data‐driven pages: meta JSON → Model objects → bound to UI via Helpers/Converters.
• Modular organization: Controls, Helpers, Converters, Layouts, Models each live in their own folder.