Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
microsoft avatar

Winui Design

  • 157 installs
  • 373 repo stars
  • Updated August 3, 2026
  • microsoft/win-dev-skills

winui-design is an agent skill for WinUI 3 UI planning, winui-search.exe control lookup, and Fluent XAML theming and correctness.

About

The winui-design skill guides WinUI 3 UI planning and XAML correctness for Fluent Design apps. Before writing XAML, agents batch-search features with the bundled winui-search.exe tool indexing WinUI Gallery controls, Windows Community Toolkit scenarios, and platform patterns, then fetch canonical samples with get before coding. UI planning maps app types to anchor controls like NavigationView, TabView, or TreeView, selects inputs and feedback controls, sizes windows with a rubric because WinUI 3 lacks SizeToContent, and avoids anti-patterns such as floating cards or hardcoded colors. XAML correctness covers ThemeResource and StaticResource brush rules, high contrast system color limits, typography styles instead of raw FontSize, 4px spacing grid, acrylic pairings, and data binding with x:Bind plus UpdateSourceTrigger=PropertyChanged on TextBox two-way binds. Accessibility requires AutomationProperties on icon-only controls and correct attached property setters in code-behind. Reference files point to approved brushes, theme resources, and review checklists. Use when designing new WinUI pages, converting from WPF or web, reviewing XAML, or fixing theme issues.

  • Requires winui-search.exe lookups before writing any XAML.
  • Maps app types to anchor controls and Fluent layout patterns.
  • Window sizing rubric with DPI-aware AppWindow.Resize examples.
  • Enforces ThemeResource brushes, typography styles, and 4px spacing grid.
  • Covers x:Bind binding rules, accessibility, and high contrast constraints.

Winui Design by the numbers

  • 157 all-time installs (skills.sh)
  • +26 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #999 of 1,880 Design & UI/UX skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

winui-design capabilities & compatibility

Capabilities
winui search.exe control catalogue lookup · app type to anchor control mapping · dpi aware window sizing rubric · themeresource and high contrast brush rules · x:bind and accessibility xaml patterns
Use cases
ui design · frontend
From the docs

What winui-design says it does

Before picking controls, search the catalogue.
SKILL.md
npx skills add https://github.com/microsoft/win-dev-skills --skill winui-design

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs157
repo stars373
Last updatedAugust 3, 2026
Repositorymicrosoft/win-dev-skills

How do I design a WinUI 3 page with correct controls, theming, spacing, and XAML patterns?

Plan WinUI 3 layouts, select controls via winui-search.exe, and enforce Fluent theming, typography, spacing, and XAML correctness.

Who is it for?

Developers designing or reviewing WinUI 3 XAML who need Fluent control selection and correctness rules.

Skip if: Skip for non-WinUI platforms, backend logic, or runtime UI testing without design review needs.

When should I use this skill?

User designs WinUI pages, reviews XAML, fixes theme issues, or converts from WPF or web UI.

What you get

A Fluent-aligned WinUI layout with canonical control samples, correct brushes, typography, and accessible XAML.

Files

SKILL.mdMarkdownGitHub ↗

UI Planning

Before picking controls, search the catalogue. This skill ships winui-search.exe alongside this SKILL.md. It indexes 100+ WinUI Gallery controls, every Windows Community Toolkit scenario, and a curated set of platform integration patterns (JumpList, Share, file pickers, drag-drop). Use it to ground every control choice in a real shipping sample before writing any XAML — this is the difference between guessing property names and copying canonical code.

>

```powershell
.\winui-search.exe search "<feature 1>" "<feature 2>" ... # batch one focused query per feature
.\winui-search.exe get <id 1> <id 2> ... # batch up to 3 IDs — full XAML + C# + pitfall notes
.\winui-search.exe list # browse all patterns (heavy — prefer search)
.\winui-search.exe update # force refresh now
```

>

Workflow: in one search call, list every feature you need for the current page (one focused query per feature, not a bag of keywords) → from each shortlist pick the best ID → grab full code with get (batch up to 3 IDs per call) → then write XAML using those samples as reference. Do NOT interleave searching with coding — front-load all lookups, then code. BM25 rewards focused per-query phrasing, so keep each query about one control or pattern.
Step 1: Identify App Type and Anchor Control
App TypeAnchor ControlReference App
Settings / config toolNavigationView Left + SettingsCardWindows Settings
Document / session editorTabView + full-width contentWindows Terminal, Notepad
Hierarchical browserTreeView + ListView + BreadcrumbBarFile Explorer
Developer tool / dashboardNavigationView + card layoutDev Home
Single-purpose utilityMode switcher + compact gridCalculator
Step 2: Map Requirements to Controls

Navigation: 2-7 sections → NavigationView; document tabs → TabView; breadcrumb trail → BreadcrumbBar; 2-3 modes → SelectorBar.

Data display: Vertical list → ListView; tiles/grid → GridView or ItemsRepeater + UniformGridLayout; hierarchy → TreeView; tabular → ListView with Grid column headers; master-detail → ListView + detail Grid.

Input: Text → TextBox; number → NumberBox; search → AutoSuggestBox; date → CalendarDatePicker; boolean → ToggleSwitch; pick one from 2-3 → RadioButtons; pick one from 4+ → ComboBox.

Feedback: Blocking decision → ContentDialog; contextual action → Flyout/MenuFlyout; onboarding → TeachingTip; inline status → InfoBar; system notification → AppNotification.

Step 3: Plan Layout
  • Content fills the window — no floating cards on empty backgrounds
  • Grid for structure, StackPanel only for simple stacking of few items
  • Sidebar: fixed 300-360px width; main content: Width="*" with 24px padding
  • Status bar: Grid row at bottom; toolbar: CommandBar or title bar buttons
Step 4: Size the Window to the App
WinUI 3 has no `SizeToContent`. Without an explicit size, Windows defaults the main window to ~1024×768 — oversized for most utilities. Size the window in `MainWindow`'s constructor; derive from the layout, not a generic.

Rubric. Width = widest row + 48 padding (24 each side), rounded up to nearest 20. Height = 32 (titlebar) + Σ(row heights) + Σ(spacing) + 48 padding, rounded up to 20. Round up — clipped content is a worse failure than a slightly-wide window.

Sanity check (ranges, not targets — derive yours from the rubric):

  • Single-purpose utility → ~440–560 wide
  • Form / single-page tool → ~600–800 wide, ~640–800 tall
  • Multi-pane (nav + content) → ~1100–1300 wide, ~720–840 tall
  • Document / canvas / media editor → 1280+ wide

If your derived number is well below its range, you missed a row — re-check.

AppWindow.Resize takes physical pixels, not DIPs — multiply by the monitor's DPI scale:

using Microsoft.UI;
using Microsoft.UI.Windowing;
using System.Runtime.InteropServices;
using Windows.Graphics;

public sealed partial class MainWindow : Window
{
    [DllImport("user32.dll")]
    private static extern uint GetDpiForWindow(IntPtr hWnd);

    public MainWindow()
    {
        InitializeComponent();
        var hwnd  = Win32Interop.GetWindowFromWindowId(AppWindow.Id);
        var scale = GetDpiForWindow(hwnd) / 96.0;
        AppWindow.Resize(new SizeInt32((int)(460 * scale), (int)(860 * scale)));
    }
}

XamlRoot.RasterizationScale is null in the ctor and stale after AppWindow.Move, so [DllImport] is the cleanest path. Don't try to size the window by setting Width/Height on the root Grid — that clips content, not the window.

If the user asks for UI validation, see winui-ui-testing Step 3.5 to verify the rubric against the visual checklist.

Step 5: Design Anti-Patterns
❌ Don't✅ Do Instead
Centered floating card on backgroundContent fills window with padding
Custom pill/segment tab switcherNavigationView Top or SelectorBar
Equal-width 50/50 column splitFixed sidebar (300-360px) + flexible main
Hardcoded colors (#FF0000){ThemeResource} brushes
ScrollViewer around ListViewListView has built-in scrolling
Custom ControlTemplate for standard controlsBuilt-in controls with style overrides

XAML Correctness

Theming Rules
  • `{ThemeResource BrushName}` at usage sites — updates on theme change
  • `{StaticResource}` with ResourceKey redirects inside theme dictionaries — zero allocation
  • `ResourceKey` must end in `Brush` (target the SolidColorBrush, not the Color)
  • Always define all three variants: x:Key="Light", x:Key="Dark", x:Key="HighContrast" — never use x:Key="Default"
  • Verify runtime theme switching: {ThemeResource} updates; {StaticResource} does not
<!-- Correct: StaticResource redirect in theme dictionary -->
<StaticResource x:Key="MyBrush" ResourceKey="ControlFillColorDefaultBrush" />

<!-- Wrong: inline SolidColorBrush allocates new object -->
<SolidColorBrush x:Key="MyBrush" Color="{StaticResource ControlFillColorDefault}" />
High Contrast

Only 8 system color brushes allowed in HC dictionaries:

BackgroundForegroundUse Case
SystemColorWindowColorBrushSystemColorWindowTextColorBrushGeneral content
SystemColorHighlightColorBrushSystemColorHighlightTextColorBrushSelected/hover
SystemColorButtonFaceColorBrushSystemColorButtonTextColorBrushButtons
SystemColorWindowColorBrushSystemColorHotlightColorBrushHyperlinks
SystemColorWindowColorBrushSystemColorGrayTextColorBrushDisabled content

HC prohibitions: No hardcoded colors, no opacity, no accent colors, no regular WinUI brushes, no SystemColor* in Light/Dark dicts. Use empty HC dict when WinUI defaults suffice. Set HighContrastAdjustment = None at app level.

Typography — Use Styles, Not Raw FontSize
StyleSizeWeightUse For
CaptionTextBlockStyle12pxRegularSmall labels, timestamps
BodyTextBlockStyle14pxRegularBody text (default — don't set explicitly)
BodyStrongTextBlockStyle14pxSemiboldEmphasized body text
SubtitleTextBlockStyle20pxSemiboldSection headers, card titles
TitleTextBlockStyle28pxSemiboldPage titles
TitleLargeTextBlockStyle40pxSemiboldLarge feature titles
DisplayTextBlockStyle68pxSemiboldHero text

Use SemiBold, never Bold. Minimum 12px. BasedOn styles must not re-declare inherited properties.

Spacing and Layout
  • 4px grid: margins, padding, sizes must be multiples of 4 (4, 8, 12, 16, 24, 32, 48)
  • ControlCornerRadius (4px) for controls, OverlayCornerRadius (8px) for overlays — never hardcode
  • RowSpacing/ColumnSpacing instead of spacer elements
  • MinHeight/MinWidth instead of fixed sizing
  • No negative margins
Remove Defaults

Don't set WinUI default values — blocks future updates:

  • BodyTextBlockStyle on TextBlock, TextFillColorPrimaryBrush foreground, TextWrapping="NoWrap", Padding="0", Margin="0"
Acrylic Pairings
SurfaceBackgroundBorder
Flyouts, tooltipsAcrylicBackgroundFillColorDefaultBrushSurfaceStrokeColorFlyoutBrush
UI surfacesAcrylicBackgroundFillColorBaseBrushSurfaceStrokeColorDefaultBrush

Use BackgroundSizing="InnerBorderEdge" on bordered acrylic. ThemeShadow requires Translation="0,0,32" and 12px parent padding.

Data Binding
  • {x:Bind} over {Binding}, explicit Mode=OneWay/TwoWay, x:DataType on DataTemplate
  • TextBox `x:Bind TwoWay` — always add `UpdateSourceTrigger=PropertyChanged` so the ViewModel updates on each keystroke instead of waiting for LostFocus. Without it, UIA automation (set-value) and programmatic changes won't commit to the ViewModel.
  <TextBox Text="{x:Bind ViewModel.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  • Commands over Click/Tapped handlers (MVVM)
  • VisualStateManager for visual property changes, not code-behind
  • No IValueConverter — prefer x:Bind with functions

Bool negation and Visibility functions — define static methods in code-behind:

// In code-behind (e.g., MainPage.xaml.cs)
public static Visibility BoolToVisibility(bool value) =>
    value ? Visibility.Visible : Visibility.Collapsed;
public static Visibility InvertBoolToVisibility(bool value) =>
    value ? Visibility.Collapsed : Visibility.Visible;
public static bool IsNotBusy(bool isLoading) => !isLoading;
<!-- Usage in XAML -->
Visibility="{x:Bind local:MainPage.BoolToVisibility(ViewModel.IsLoading), Mode=OneWay}"
IsEnabled="{x:Bind local:MainPage.IsNotBusy(ViewModel.IsLoading), Mode=OneWay}"

❌ NEVER use Converter={x:Null} — it crashes at runtime.

Accessibility
  • AutomationProperties.Name on icon-only controls
  • AutomationProperties.AutomationId on all interactive controls
  • Semantic controls (Button, HyperlinkButton) — not clickable Border/TextBlock
  • DividerStrokeColorDefaultBrush for dividers

Setting attached properties in code-behind — WinUI attached properties use static methods, NOT object initializer syntax:

using Microsoft.UI.Xaml.Automation; // required for AutomationProperties

// ❌ WRONG — object initializer doesn't work for attached properties
var btn = new Button { AutomationProperties = { AutomationId = "BtnSave" } };

// ✅ CORRECT — static setter method
var btn = new Button { Content = "Save" };
AutomationProperties.SetAutomationId(btn, "BtnSave");
AutomationProperties.SetName(btn, "Save button");
Grid.SetRow(btn, 1);
Grid.SetColumn(btn, 0);
ToolTipService.SetToolTip(btn, "Save the current document");
Formatting
  • Self-closing tags for childless elements
  • Styles referenced with {StaticResource} not {ThemeResource}
  • No px suffix on numeric values, no commented-out XAML
  • Consistent attribute order: x:Name, AutomationProperties, layout, content, style

References

FileRead when...
references/approved-brushes.mdLooking up correct WinUI brush names and usage rules
references/theme-aware-resources.mdImplementing ThemeResource/StaticResource, High Contrast, acrylic pairings
references/code-review-checklist.mdReviewing XAML changes for correctness
references/pr-review-patterns.mdApplying concrete review fixes and patterns
references/control-styles.mdCustomizing built-in control styles
references/typography-and-spacing.mdDetailed type ramp, spacing grid, and sizing examples
references/colors-and-materials.mdTheme brush catalog, Mica/Acrylic surface pairings, material usage
references/iconography-and-motion.mdIcon guidelines, animation patterns, connected animations

Related skills

FAQ

What tool should I use before writing WinUI XAML?

Run winui-search.exe search and get to ground control choices in canonical Gallery and Toolkit samples.

How should I size a WinUI 3 window?

Derive width and height from layout rows in MainWindow constructor using DPI-scaled AppWindow.Resize.

Is winui-design safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.