creating-mewui-controls

Creates custom MewUI controls with measure, arrange, render, and input handling in C#.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building custom controls in the MewUI framework requires correctly implementing measure, arrange, render, and input handling overrides, and small mistakes like wrong event argument types or missing child rendering cause broken layouts and unresponsive controls. ## Core Features & Use Cases - Control Base Class Guidance: Choose between Control, ContentControl, and Panel base classes with correct override patterns for MeasureContent, ArrangeContent, and OnRender. - Input Handling Patterns: Implement mouse capture via Window, keyboard events, focus overrides, hit testing, and drag logic using MewUI's MouseEventArgs conventions. - Binding and Fluent Extensions: Add ValueBinding support and fluent extension methods for declarative control configuration. - Use Case: When building a custom button or card container in a MewUI application, follow the provided templates to get correct rendering, theming, and click handling without trial-and-error against the framework API. ## Quick Start Ask the AI to create a custom MewUI button control with text rendering, hover states, and click handling.

Frequently Asked Questions about creating-mewui-controls

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

FAQPage Schema
How do I create a custom control in MewUI?▼

Derive from Control, ContentControl, or Panel depending on your use case, then override MeasureContent for sizing, OnRender for drawing, and input handlers like OnMouseDown. Enable focus by overriding the Focusable property rather than setting it.

How do I handle mouse events in MewUI controls?▼

Override OnMouseDown, OnMouseUp, and OnMouseMove using MouseEventArgs, checking e.LeftButton for button state. Mouse capture is managed through the Window via CaptureMouse and ReleaseMouseCapture, not on the element itself.

Which base class should I use for a MewUI container control?▼

Use ContentControl for single-child containers like cards, and Panel for multi-child layouts. ContentControl requires overriding Render to explicitly render the child and managing the Content property's parent relationships.

Why is my MewUI control not receiving keyboard input?▼

The control must be focusable, which requires overriding the Focusable property to return true rather than setting it. Then call Focus() and handle OnKeyDown or OnTextInput for keyboard events.

How do I add data binding to a custom MewUI control?▼

Create a ValueBinding with getter, setter, and subscribe/unsubscribe callbacks, typically exposed through a SetBinding method. Fluent extension methods can wrap this to bind ObservableValue sources declaratively.