WPF UI - Architecture Documentation
| Property |
Value |
| Project |
WPF UI (wpfui) |
| Version |
4.2.0 |
| Type |
Open-source WPF UI control library |
| License |
MIT |
| Language |
C# 14 / XAML |
| Platforms |
.NET 10/9/8 + .NET Framework 4.6.2/4.7.2/4.8.1 |
Overview
WPF UI is an open-source library that implements the Microsoft Fluent Design System for Windows Presentation Foundation (WPF) applications. It provides 77+ custom controls, a full theming system with light/dark/high-contrast modes, Win32 interop for modern window chrome effects (Mica, Acrylic, Tabbed backdrops), navigation services, and icon support through the Fluent System Icons font family.
The library enables thousands of developers to modernize legacy WPF applications with contemporary Windows 11 visual styles without migrating to WinUI 3 or MAUI.
Table of Contents
Architecture Views
| Document |
Description |
| C4 Context (Level 1) |
System context diagram showing WPF UI in its environment -- consumer applications, Windows OS, distribution channels |
| Logical Architecture |
Module dependencies, layer diagram, core library internal component structure, detected patterns |
Software Design Documents (SDD)
| Document |
Description |
| CONSTITUTION.md |
Project constitution -- coding conventions, boundary system (ALWAYS DO / ASK FIRST / NEVER DO), rules files summary |
| IMPLEMENTATION-GUIDE.md |
Step-by-step guides for common tasks -- adding controls, services, gallery pages, Win32 interop, theming, testing |
| TESTING-SPEC.md |
Testing specification -- frameworks, templates, naming conventions, run commands |
| MODULE-INTERFACES.md |
Module interface contracts -- public vs internal API surface per module, dependency rules |
Cross-Cutting Concerns
| Document |
Description |
| Testing |
Test strategy, frameworks, naming conventions, coverage gaps |
| Theming and Appearance |
Theme system architecture, accent colors, backdrop effects, theme change flow |
| Win32 Interop |
Three-layer interop architecture, key APIs, handle validation, WndProc patterns |
| Navigation |
Navigation system lifecycle, page caching strategy, DI integration, transition animations |
Architecture Decision Records (ADRs)
| ADR |
Decision |
| ADR-001 |
Multi-target framework strategy (net10.0 through net462) |
| ADR-002 |
WPF control library architecture with Fluent Design |
| ADR-003 |
Win32 interop via CsWin32 source generator |
| ADR-004 |
Static singleton managers for theming (implicit) |
| ADR-005 |
Feature-folder organization for controls (implicit) |
Other
Quick Architecture Summary
WPF UI is organized as a set of layered NuGet packages built from a single solution:
- Wpf.Ui.Abstractions -- Zero-dependency contract interfaces (
INavigationViewPageProvider, INavigationAware, INavigableView<T>). Targets .NET and .NET Standard 2.0/2.1 for maximum portability.
- Wpf.Ui -- Core library with 77+ controls, the theming engine, Win32 interop, services, converters, animations, and icon support. This is the primary NuGet package (
WPF-UI).
- Wpf.Ui.DependencyInjection -- Microsoft.Extensions.DependencyInjection integration for type-based page resolution.
- Wpf.Ui.Tray -- System tray icon support via Shell32 P/Invoke.
- Wpf.Ui.SyntaxHighlight -- Syntax-highlighted code display control.
- Wpf.Ui.ToastNotifications -- Toast notification support (stub, not yet implemented).
- Wpf.Ui.FlaUI -- FlaUI automation element wrappers for integration testing.
- Wpf.Ui.FontMapper -- Build-time tool that generates
SymbolRegular/SymbolFilled enums from Fluent System Icons font data.
- Wpf.Ui.Gallery -- Comprehensive demo application showcasing all controls.
- Wpf.Ui.Extension -- Visual Studio 2022 extension with project templates.
Key Architectural Concerns
- Control Architecture -- Folder-per-control pattern with paired
.cs + .xaml files. Controls extend standard WPF base classes and implement capability interfaces (IAppearanceControl, IIconControl).
- Theming System -- Runtime resource dictionary swapping managed by
ApplicationThemeManager. Accent colors derived from system settings via WinRT UISettings or DWM registry.
- Win32 Interop -- Three-layer architecture: CsWin32 source-generated P/Invoke, managed wrappers (
UnsafeNativeMethods), and high-level utilities. Enables DWM backdrop effects, custom window chrome, and system theme detection.
Technology Stack
Repository Structure