← ClaudeAtlas

creating-graphics-in-codelisted

Creates WPF graphics dynamically in C# code using Shape, PathGeometry, and PathFigure classes. Use when building charts, diagrams, or procedurally generated graphics.
christian289/dotnet-with-claudecode · ★ 41 · Web & Frontend · score 73
Install: claude install-skill christian289/dotnet-with-claudecode
# Creating WPF Graphics in Code Programmatically create shapes and geometry for dynamic graphics. ## 1. Shape Factory Pattern ```csharp namespace MyApp.Graphics; using System.Windows; using System.Windows.Media; using System.Windows.Shapes; public static class ShapeFactory { /// <summary> /// Create circular marker /// </summary> public static Ellipse CreateCircle(double size, Brush fill, Brush? stroke = null) { var ellipse = new Ellipse { Width = size, Height = size, Fill = fill }; if (stroke is not null) { ellipse.Stroke = stroke; ellipse.StrokeThickness = 1; } return ellipse; } /// <summary> /// Create rectangle with optional corner radius /// </summary> public static Rectangle CreateRectangle( double width, double height, Brush fill, double cornerRadius = 0) { return new Rectangle { Width = width, Height = height, Fill = fill, RadiusX = cornerRadius, RadiusY = cornerRadius }; } /// <summary> /// Create line between two points /// </summary> public static Line CreateLine(Point start, Point end, Brush stroke, double thickness = 1) { return new Line { X1 = start.X, Y1 = start.Y, X2 = end.X, Y2 = end.Y,