creating-mewui-controls

Solid

Creates custom MewUI controls with proper measure, arrange, render, and input handling. Use when building new interactive controls, extending existing controls, or implementing custom rendering.

Web & Frontend 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 81/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

## Control Base Classes | Base | Use Case | |------|----------| | `Control` | Interactive elements (buttons, inputs) | | `ContentControl` | Single-child containers | | `Panel` | Multi-child layouts | --- ## Basic Control Structure ```csharp public class MyButton : Control { private bool _isPressed; // Property with invalidation public string Text { get; set { if (field != value) { field = value; InvalidateMeasure(); } } } = ""; // Enable focus by overriding (not setting property) public override bool Focusable => true; // Measure: calculate desired size protected override Size MeasureContent(Size availableSize) { var factory = GetGraphicsFactory(); using var ctx = factory.CreateMeasurementContext(GetDpi()); var textSize = ctx.MeasureText(Text, GetFont()); return new Size(textSize.Width + Padding.Horizontal, textSize.Height + Padding.Vertical); } // Render: draw the control protected override void OnRender(IGraphicsContext context) { var bounds = new Rect(0, 0, Bounds.Width, Bounds.Height); var bgColor = _isPressed ? Theme.Palette.ButtonPressedBackground : IsMouseOver ? Theme.Palette.ButtonHoverBackground : Theme.Palette.ButtonFace; context.FillRoundedRectangle(bounds, 4, 4, bgColor); context.DrawRoundedRectangle(bounds, 4, 4, ...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category