docs(rules): add WPF accessibility and theming, trim WPF rules

A new WPF topic rule covers accessibility (AutomationProperties names
and help text, keyboard access, visible focus, high contrast through
SystemColors, automation peers for custom controls), DPI scaling in
device-independent units with tests across scale factors and monitors,
and the Fluent theme through ThemeMode on .NET 9 and later.

The existing WPF rules lose about a quarter of their size by merging
one-line generic bullets that the C# and shared rules already cover,
while keeping the WPF-specific pitfalls. Duplicate async void and
binding error guidance is merged, client secret handling defers to the
client app security rule, the architecture rule asks to check .NET
Framework versus .NET before using newer APIs, and the CommunityToolkit
note states that partial properties require C# 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-18 10:14:24 +01:00
1 parent b6c33780c3
commit df09ddeaa9
8 files changed
+69 -185

No files matched your search

@@ -4,34 +4,17 @@ Apply these rules when managing resources and styles, windows and dialogs, navig
## Resources and Styles
* Use shared resources for repeated styles, brushes, templates and dimensions.
* Keep resource dictionaries focused.
* Avoid giant global resource dictionaries.
* Prefer feature-level resources when styles are not truly global.
* Use `StaticResource` by default.
* Use `DynamicResource` only when runtime resource replacement is required.
* Avoid excessive dynamic resource lookups.
* Keep theme resources separated from application logic.
* Avoid hardcoded colors and dimensions when design tokens or resources already exist.
* Use shared resources for repeated styles, brushes, templates, and dimensions, in focused dictionaries at feature level unless truly global; avoid hardcoded colors and sizes when resources exist.
* Use `StaticResource` by default and `DynamicResource` only where runtime replacement is required, such as theme switching.
## Windows and Dialogs
* Keep window lifecycle explicit.
* Avoid creating duplicate windows unintentionally.
* Do not keep hidden windows alive without a reason.
* Separate dialog logic from business logic.
* Keep window lifecycle and `Owner` relationships explicit, avoid duplicate or hidden windows kept alive without reason, and set `ShutdownMode` deliberately instead of relying on accidental window lifetime.
* Show dialogs through the dialog service described in the MVVM rule.
* Keep ownership relationships explicit.
* Avoid application shutdown behavior that depends on accidental window lifetime.
## Navigation
* Keep navigation state explicit.
* Avoid coupling ViewModels directly to concrete views.
* Avoid service locator patterns for view resolution.
* Keep navigation history intentional.
* Dispose or release navigation targets when they are no longer required.
* Do not retain entire navigation graphs unnecessarily.
* Keep navigation state and history explicit, map view models to views without service locators, and release navigation targets that are no longer needed.
## Memory Management
@@ -45,11 +28,7 @@ Apply these rules when managing resources and styles, windows and dialogs, navig
* Closures
* Collection views
* Binding-related references: binding to a CLR property of a source that does not implement `INotifyPropertyChanged` keeps the source alive; bind only to `INotifyPropertyChanged` or dependency-property sources.
* Dispose resources correctly.
* Stop timers and background work when no longer needed.
* Avoid retaining closed windows or unloaded views.
* Do not keep unnecessary references to visual elements.
* Profile memory when long-running applications continuously grow.
* Dispose resources, stop timers and background work, and release closed windows, unloaded views, and visual element references. Profile memory when a long-running app keeps growing.
## Images and Media