Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze and fix WPF applications for high DPI support, per-monitor DPI awareness, and scaling issues
.claude/skills/a5c-ai-wpf-high-dpi-analyzer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 56% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 47% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 1538% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 169% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 199% | 0% |
Analyze and fix WPF applications for high DPI support. This skill identifies DPI-related issues and provides fixes for per-monitor DPI awareness, bitmap scaling, and layout problems on high-resolution displays.
json{ "type": "object", "properties": { "projectPath": { "type": "string", "description": "Path to the WPF project" }, "targetDpiMode": { "enum": ["system", "per-monitor", "per-monitor-v2"], "default": "per-monitor-v2" }, "checkCategories": { "type": "array", "items": { "enum": ["manifest", "hardcoded-pixels", "bitmaps", "layouts", "transforms", "fonts"] }, "default": ["manifest", "hardcoded-pixels", "bitmaps", "layouts"] }, "generateFixes": { "type": "boolean", "default": true } }, "required": ["projectPath"] }
json{ "type": "object", "properties": { "success": { "type": "boolean" }, "dpiMode": { "type": "string" }, "issues": { "type": "array", "items": { "type": "object", "properties": { "severity": { "enum": ["critical", "high", "medium", "low"] }, "category": { "type": "string" }, "file": { "type": "string" }, "line": { "type": "number" }, "description": { "type": "string" }, "fix": { "type": "string" } } } }, "recommendations": { "type": "array", "items": { "type": "string" } } }, "required": ["success", "issues"] }
xml<!-- app.manifest --> <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> </windowsSettings> </application>
xml<application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> </windowsSettings> </application>
xml<application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> </windowsSettings> </application>
xml<!-- BAD: Hardcoded pixels --> <Button Width="100" Height="30"/> <Grid Margin="10,5,10,5"/> <TextBlock FontSize="12"/> <!-- GOOD: Use device-independent units or relative sizing --> <Button MinWidth="80" MinHeight="24" Padding="16,4"/> <Grid Margin="{StaticResource StandardMargin}"/> <TextBlock Style="{StaticResource BodyTextStyle}"/>
xml<!-- BAD: Single resolution bitmap --> <Image Source="icon.png"/> <!-- GOOD: Use vector or provide multiple resolutions --> <Image> <Image.Source> <DrawingImage> <!-- Vector drawing --> </DrawingImage> </Image.Source> </Image> <!-- Or use BitmapScalingMode for crisp scaling --> <Image Source="icon.png" RenderOptions.BitmapScalingMode="HighQuality"/>
csharp// Handle DPI changes at runtime public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // Get current DPI var dpiScale = VisualTreeHelper.GetDpi(this); Debug.WriteLine($"DPI: {dpiScale.PixelsPerDip * 96}"); } protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) { base.OnDpiChanged(oldDpi, newDpi); // Handle DPI change Debug.WriteLine($"DPI changed from {oldDpi.PixelsPerDip * 96} to {newDpi.PixelsPerDip * 96}"); // Reload high-DPI assets if needed ReloadAssets(newDpi); } private void ReloadAssets(DpiScale dpi) { // Load appropriate resolution assets var scale = dpi.PixelsPerDip; string suffix = scale >= 2 ? "@2x" : scale >= 1.5 ? "@1.5x" : ""; // Load assets with suffix } }
csharp// App.xaml.cs public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { // Enable Per-Monitor V2 DPI awareness (Windows 10 1703+) if (Environment.OSVersion.Version >= new Version(10, 0, 15063)) { // Per-Monitor V2 is automatic with manifest, but verify var awareness = GetProcessDpiAwareness(); Debug.WriteLine($"DPI Awareness: {awareness}"); } base.OnStartup(e); } [DllImport("shcore.dll")] private static extern int GetProcessDpiAwareness(IntPtr hprocess, out int awareness); private static int GetProcessDpiAwareness() { GetProcessDpiAwareness(IntPtr.Zero, out int awareness); return awareness; } }
csharp// BAD: Manual scaling calculations var scale = 96.0 / GetSystemDpi(); transform.ScaleX = scale; transform.ScaleY = scale; // GOOD: Let WPF handle scaling // Use device-independent units, WPF handles the rest <Canvas> <Rectangle Canvas.Left="10" Canvas.Top="10" Width="100" Height="50"/> </Canvas>
xml<!-- BAD: Hardcoded font size --> <TextBlock FontSize="14"/> <!-- GOOD: Use named styles or relative sizing --> <TextBlock Style="{DynamicResource MaterialDesignBody1TextBlock}"/> <!-- Or use system font size --> <TextBlock FontSize="{x:Static SystemFonts.MessageFontSize}"/>
xml<!-- .csproj --> <PropertyGroup> <TargetFramework>net8.0-windows</TargetFramework> <UseWPF>true</UseWPF> <!-- Enable high DPI support --> <ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode> </PropertyGroup> <!-- Include app.manifest --> <ItemGroup> <None Update="app.manifest"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup>
powershell# Change display scaling via PowerShell (requires restart) Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LogPixels" -Value 144 # 150% # Test with multiple monitors at different DPIs # Use Windows display settings to set different scales per monitor
wpf-xaml-style-generator - DPI-aware stylesdesktop-accessibility process - Accessibility testingvisual-regression-setup - Visual testing at different DPIswpf-dotnet-expert - WPF expertisedesktop-ux-analyst - UX review| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 13,257 | 9,152 | -31% | 1 | 1 | 0% | 2,666 | 4,157 | +56% | 0 | 0 | — |
case-02 | fail→pass | 16,424 | 8,347 | -49% | 1 | 1 | 0% | 2,739 | 4,014 | +47% | 0 | 0 | — |
case-03 | fail→pass | 4,693 | 10,193 | +117% | 1 | 1 | 0% | 260 | 4,260 | +1538% | 0 | 0 | — |
case-04 | pass→pass | 27,036 | 19,136 | -29% | 1 | 1 | 0% | 6,174 | 7,031 | +14% | 0 | 0 | — |
case-05 | pass→pass | 12,357 | 11,518 | -7% | 1 | 1 | 0% | 2,424 | 4,204 | +73% | 0 | 0 | — |
case-06 | pass→pass | 18,783 | 14,387 | -23% | 1 | 1 | 0% | 3,988 | 5,352 | +34% | 0 | 0 | — |
case-07 | pass→fail | 10,760 | 8,373 | -22% | 1 | 1 | 0% | 2,109 | 3,617 | +72% | 0 | 0 | — |
case-08 | fail→fail | 14,615 | 11,263 | -23% | 1 | 1 | 0% | 2,828 | 4,361 | +54% | 0 | 0 | — |
case-09 | pass→pass | 14,318 | 8,777 | -39% | 1 | 1 | 0% | 2,402 | 4,101 | +71% | 0 | 0 | — |
case-10 | pass→pass | 9,140 | 6,596 | -28% | 1 | 1 | 0% | 1,605 | 3,320 | +107% | 0 | 0 | — |
case-11 | fail→pass | 6,184 | 5,029 | -19% | 1 | 1 | 0% | 1,133 | 3,044 | +169% | 0 | 0 | — |
case-12 | fail→pass | 5,141 | 3,320 | -35% | 1 | 1 | 0% | 925 | 2,762 | +199% | 0 | 0 | — |
case-13 | pass→pass | 9,406 | 6,220 | -34% | 1 | 1 | 0% | 1,918 | 3,387 | +77% | 0 | 0 | — |
case-14 | pass→pass | 14,714 | 3,433 | -77% | 1 | 1 | 0% | 2,874 | 2,704 | -6% | 0 | 0 | — |
case-15 | pass→pass | 13,281 | 11,131 | -16% | 1 | 1 | 0% | 2,487 | 4,601 | +85% | 0 | 0 | — |
case-16 | pass→pass | 15,926 | 13,278 | -17% | 1 | 1 | 0% | 2,837 | 4,593 | +62% | 0 | 0 | — |
case-17 | pass→pass | 10,260 | 5,906 | -42% | 1 | 1 | 0% | 1,985 | 3,337 | +68% | 0 | 0 | — |
case-18 | pass→pass | 5,647 | 2,318 | -59% | 1 | 1 | 0% | 1,127 | 2,621 | +133% | 0 | 0 | — |
case-19 | pass→pass | 6,637 | 3,216 | -52% | 1 | 1 | 0% | 1,366 | 2,754 | +102% | 0 | 0 | — |
case-20 | pass→pass | 5,947 | 3,267 | -45% | 1 | 1 | 0% | 1,244 | 2,776 | +123% | 0 | 0 | — |
case-21 | pass→pass | 14,368 | 8,771 | -39% | 1 | 1 | 0% | 2,730 | 3,709 | +36% | 0 | 0 | — |
case-22 | pass→pass | 5,920 | 1,785 | -70% | 1 | 1 | 0% | 1,031 | 2,440 | +137% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +18 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.