Table of Contents ▾
Overview
This guide outlines the visual language and styling conventions for native Windows applications built with WinUI, UWP, and the Windows App SDK. Following these standards ensures consistency, accessibility, and a modern user experience across the Microsoft ecosystem.
Naming Conventions
Element | Pattern | Example |
---|---|---|
Resource Dictionary | {Component}Resources.xaml | ShellResources.xaml |
Style Key | {Target}{State}Style | ButtonPrimaryStyle |
Control Template | {Control}Template | ComboBoxTemplate |
Color Palette
The primary palette is based on the Fluent Design System. Use the following semantic colors for consistency.
<Color x:Key="ColorPrimary">#0067B8</Color>
<Color x:Key="ColorPrimaryDark">#004880</Color>
<Color x:Key="ColorPrimaryLight">#E5F1FF</Color>
<Color x:Key="ColorAccent">#0099BC</Color>
<Color x:Key="ColorAccentSecondary">#00B294</Color>
<Color x:Key="ColorNeutral100">#FFFFFF</Color>
<Color x:Key="ColorNeutral200">#F5F7FA</Color>
<Color x:Key="ColorNeutral600">#6C757D</Color>
<Color x:Key="ColorNeutral900">#212529</Color>
</ResourceDictionary>
Typography
Use Segoe UI as the default typeface. Sizes and weights are defined below.
Usage | Font Size | Weight |
---|---|---|
Title (H1) | 28 px | SemiBold |
Section (H2) | 22 px | Bold |
Body | 14 px | Regular |
Caption | 12 px | Light |
Layout & Grids
Adopt a 4‑pixel baseline grid. Margins and paddings should be multiples of 4.
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
...
</Grid>
Standard Controls
All controls must use the Fluent styles provided by the Microsoft.UI.Xaml
namespace. Below is a sample Button style.
<Style x:Key="ButtonPrimaryStyle" TargetType="Button">
<Setter Property="Background">{ThemeResource ColorPrimary}</Setter>
<Setter Property="Foreground">White</Setter>
<Setter Property="CornerRadius">4</Setter>
<Setter Property="Padding">12,6</Setter>
<Setter Property="FontSize">14</Setter>
<Setter Property="FontWeight">SemiBold</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPointerOver" Value="True">
<Setter Property="Background" Value="{ThemeResource ColorPrimaryDark}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Best Practices
- Prefer system theme resources (
ThemeResource
) over hard‑coded colors. - Support high‑contrast and dark mode by providing appropriate
Color
resources. - Ensure all interactive elements have a minimum touch target of
48 dp
. - Validate contrast ratios (≥4.5:1 for normal text) using the Fluent Contrast Checker.
- Localize strings and consider right‑to‑left layouts where applicable.