askill
winui-xaml

winui-xamlSafety --Repository

WinUI 3 and XAML best practices for layout, binding, async operations, collections, rendering, memory management, accessibility, and localization. Use when: (1) Working with WinUI 3 or Uno Platform XAML, (2) Optimizing UI performance, (3) Implementing data binding with x:Bind, (4) Managing collections and virtualization, (5) Ensuring accessibility compliance, (6) Handling async operations on UI thread, (7) Preventing memory leaks, (8) Implementing localization

3 stars
1.2k downloads
Updated 2/2/2026

Package Files

Loading files...
SKILL.md

WinUI 3 XAML Best Practices

Twelve categories of XAML best practices validated against WinUI 3 and Uno Platform, covering performance-critical patterns through polish optimizations.

Quick Reference - Top 10 Rules

  1. Never block the UI thread - Use async/await for all I/O and long operations
  2. Use x:Bind over Binding - Compile-time validation, 3x faster
  3. Use x:Load for conditional UI - Prevents element creation until needed
  4. Enable virtualization - ListView/ItemsRepeater for any list > 20 items
  5. Unsubscribe event handlers - Clean up in Unloaded to prevent leaks
  6. Keep visual tree shallow - Minimize nesting depth
  7. Use OneTime mode for static data - Avoid unnecessary change tracking
  8. Set AutomationProperties - Required for accessibility compliance
  9. Use x:Uid for all user-visible text - Enables localization
  10. Prefer Grid over nested StackPanels - Single layout pass vs multiple

Categories by Impact

#CategoryImpactKey Topics
1LayoutHIGHPanel selection, visual tree depth, AutoLayout, responsive design
2BindingHIGHx:Bind vs Binding, modes, function binding
3Async & ThreadingCRITICALUI thread, DispatcherQueue, parallelization
4Collections & VirtualizationCRITICALListView, ItemsRepeater, incremental loading
5Rendering & CompositionMEDIUM-HIGHComposition APIs, animations, caching
6Memory ManagementHIGHEvent handlers, leaks, resource cleanup
7AccessibilityHIGHAutomationProperties, keyboard navigation
8LocalizationMEDIUMx:Uid, .resw files, runtime switching
9Styles & ThemingMEDIUMResourceDictionary, ThemeDictionaries, lightweight styling
10XAML LoadingCRITICALx:Load, deferred loading, startup optimization
11NavigationMEDIUM-HIGHFrame caching, page lifecycle
12Input & InteractionMEDIUMTouch targets, gesture handling

Impact Levels

  • CRITICAL: Can cause app crashes, multi-second freezes, or memory leaks
  • HIGH: Noticeable performance degradation (100ms+)
  • MEDIUM-HIGH: Cumulative impact across many elements
  • MEDIUM: Optimization for polish and responsiveness

Pattern Structure

Each reference file follows this format:

### Skill Name
**Rule**: Concise imperative statement
**Why**: Technical rationale with measurable impact
**Example (XAML/C#)**: Correct implementation
**Common Mistakes**: Anti-patterns to avoid
**Uno Platform Notes**: Platform-specific gaps/workarounds (if applicable)
**Reference**: Microsoft Learn link

WinUI 3 vs UWP Key Differences

FeatureUWPWinUI 3
NamespaceWindows.UI.XamlMicrosoft.UI.Xaml
DispatcherCoreDispatcherDispatcherQueue
Deferred Loadingx:DeferLoadStrategy (deprecated)x:Load
WindowCoreWindowMicrosoft.UI.Xaml.Window
App ModelUWP sandboxDesktop (full trust)

Uno Platform Compatibility

All patterns validated against Uno Platform with notes for:

  • Platform-specific behavior differences
  • Unsupported APIs and alternatives
  • Skia renderer considerations

Using References

Consult the individual reference files listed in the table above, matched to the task at hand. Each file is self-contained with rules, code examples, common mistakes, and Uno Platform compatibility notes.

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

AI review pending.

Metadata

Licenseunknown
Version-
Updated2/2/2026
Publishermtmattei

Tags

No tags yet.