$ show Kinnara/ModernWpf
This repository is a WPF control library that ports Microsoft's WinUI3 (Fluent) design language to the Windows Presentation Foundation (WPF) framework. It provides a comprehensive set of modern UI controlsβsuch as NavigationView, CommandBar, InfoBar, TabView, SplitView, NumberBox, ColorPicker, TeachingTip, and many moreβeach with full theming support (light, dark, high-contrast), accessibility automation peers, and virtualized layout engines for high performance. The library is distributed as a NuGet package (ModernWpfUI) and is accompanied by a gallery demo application (ModernWpf.Gallery) that showcases all controls with live code samples. Architecture: The codebase is organized into two main assemblies: ModernWpf (base infrastructure: theme management, helpers, icon sources, animations, window chrome) and ModernWpf.Controls (all ported controls with their XAML templates, property definitions, and automation peers). Controls follow a declarative property system using DependencyProperty registration, and many leverage a recycling element factory (RecyclePool) for efficient item rendering in repeaters and lists. The library integrates with WPF's native theming via ResourceDictionaryEx and FluentControlsResources, merging platform Fluent dictionaries with custom theme resources. Key entry points: For consumers, the library is used by adding the ModernWpf.Controls assembly and referencing the namespace http://schemas.modernwpf.com/2019 in XAML. The gallery application entry point is ModernWpf.Gallery/App.xaml.cs. Test infrastructure includes ModernWpfTestApp and dedicated unit tests under test/ that use a custom WpfTestHost. External dependencies: WPF (System.Windows), .NET runtime, and Win32 native methods for window management (NativeMethods.cs). The build system supports multiple .NET targets (net462, net8.0-windows7.0, net10.0-windows7.0) with conditional compilation. The project maintains strict parity with upstream WinUI3 through source-audit tests that pin specific commit hashes and verify code patterns. This ensures the WPF port remains faithful to the original Fluent design, but also creates maintenance overhead when upstream changes. The library is in preview status (1.x release candidate) with a frozen 0.9.x line; API is not yet frozen.
The LLM identified 5 files worth highlighting for reuse:
Implements 20+ blend modes (Burn, Darken, Dodge, etc.) using LCH color space for saturation blending. Self-contained utility that can be extracted for any color manipulation project, demonstrating non-obvious color science implementation.
Generic event revoker pattern that uses weak references to avoid preventing garbage collection. Can be reused in any .NET project for safe event subscription management, showcasing a clean, reusable design pattern.
Core recycling mechanism for UI elements, supporting owner affinity, template-key selection, and deferred cleanup. Demonstrates efficient resource management pattern applicable to any system with reusable components, with clear separation of concerns.
Provides color interpolation across multiple color spaces (RGB, LAB, XYZ) with trim and getColor methods. Self-contained utility for color scale generation, easily extractable for gradient or color mapping tasks.
Abstract base class for virtualizing layouts, defining the contract for efficient rendering of large data sets. Demonstrates a well-architected pattern for separating layout logic from data management, reusable in any virtualized UI system.