converting-html-css-to-wpf-xaml

Converts HTML/CSS designs into WPF CustomControl XAML with documented patterns and pitfall fixes.

Updated Nov 22, 2023
One-click install
npx skills add https://github.com/parksanghoon-sys/TestCode --skill converting-html-css-to-wpf-xaml-parksanghoon-sys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: converting-html-css-to-wpf-xaml
Source: https://github.com/parksanghoon-sys/TestCode/tree/main/src/Modbus/.agents/skills/converting-html-css-to-wpf-xaml
Command: npx skills add https://github.com/parksanghoon-sys/TestCode --skill converting-html-css-to-wpf-xaml-parksanghoon-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Translating web designs written in HTML/CSS into WPF XAML is error-prone: CSS concepts like border-radius clipping, pseudo-elements, animations, and percentage-based sizing have no direct XAML equivalent, leading to broken rendering, type errors, and clipped rotating elements. ## Core Features & Use Cases - CSS-to-WPF Mapping Tables: Direct mappings for overflow/border-radius, position:absolute, animations, z-index, and transforms to their correct XAML implementations. - Documented Pitfall Cases: Eight indexed case studies (C001-C008) covering Duration type errors, Grid.Clip clipping failures, OpacityMask misuse, Canvas vs Grid layout issues, and diagonal-length height calculations. - Ready-to-Use Converters: C# implementations of SizeToRectConverter, HeightMultiplierConverter, and CenterOffsetConverter for dynamic geometry binding. - Use Case: When converting a CSS card with a rotating gradient border (border-radius + ::before + keyframe animation) to a WPF CustomControl, follow the clipping, animation, and transform references to produce correct XAML on the first attempt. ## Quick Start Convert this CSS card design with a rotating gradient border and rounded corners into a WPF CustomControl XAML template.

Frequently Asked Questions about converting-html-css-to-wpf-xaml

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert CSS border-radius with overflow hidden to WPF XAML?▼

Use Border.Clip with a RectangleGeometry whose RadiusX/RadiusY match the CornerRadius, and bind its Rect to ActualWidth/ActualHeight through a SizeToRectConverter. ClipToBounds alone only clips to a rectangle and ignores rounded corners.

How do I convert CSS animations to WPF Storyboards?▼

Map animation-duration to an inline Duration like "0:0:3", animation-iteration-count: infinite to RepeatBehavior="Forever", and @keyframes from/to to From/To values. Never bind Duration via StaticResource because TimeSpan does not auto-convert to the Duration type.

Why does my rotating element get clipped in a WPF Grid?▼

Grid determines child sizes at layout time and clips elements that rotate outside its bounds. Place rotating elements inside a Canvas with Canvas.Left/Canvas.Top positioning, since Canvas does not restrict child sizes and allows free rotation rendering.

How do I implement CSS ::before and ::after pseudo-elements in WPF?▼

WPF has no pseudo-elements, so implement them as elements inside a Canvas, using declaration order or Panel.ZIndex to control z-order. Keep the ContentPresenter outside the Canvas in a Grid so alignment properties still work.

Why does CSS height: 130% not cover corners when rotating in WPF?▼

A rotating bar must exceed the container's diagonal length, not just 130% of its height. Use a multiplier of 2.0 via a HeightMultiplierConverter and center it with a CenterOffsetConverter so the bar reaches every corner during rotation.

Does OpacityMask work for rounded corner clipping in WPF?▼

No. OpacityMask only adjusts transparency and does not perform layout clipping, so content still renders outside the rounded region. Use Border.Clip with RectangleGeometry for true geometric clipping.