navigating-mewui-tree

Traverses and manipulates the MewUI visual tree for element hierarchy and hit testing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with a custom C# UI framework's visual tree requires knowing how parents, children, roots, and hit testing interact. This Skill provides the patterns and APIs needed to navigate element hierarchies, find ancestors, handle lifecycle events, and implement custom hit-test regions in MewUI. ## Core Features & Use Cases - Tree Traversal: Find visual roots, check ancestry with IsDescendantOf/IsAncestorOf, and locate ancestors by type using generic helper methods. - Parent-Child Management: Work with Panel multi-child collections, ContentControl single content, and Border child elements. - Custom Hit Testing: Implement circular buttons, donut shapes, pass-through elements, and hotspot regions using parent-relative coordinates. - Use Case: When building a custom control in MewUI that needs a non-rectangular clickable area, use the hit-testing patterns to override OnHitTest with geometric checks like point-in-circle or point-in-triangle tests. ## Quick Start Ask the AI to show how to find the parent Window of a MewUI element and implement a circular hit test for a custom button.

Frequently Asked Questions about navigating-mewui-tree

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

FAQPage Schema
How do I find the parent or ancestor of a UI element in C#?▼

Use the element's Parent property for the direct parent, or loop through parents checking types to find an ancestor of a specific type. MewUI also provides FindVisualRoot to get the top-level Window and IsDescendantOf to check ancestry.

How to implement custom hit testing for non-rectangular UI elements?▼

Override OnHitTest and apply geometric checks such as distance-from-center for circles or point-in-triangle tests. Note that MewUI passes points in parent-relative coordinates, so use Bounds position when computing centers.

What is the difference between Panel and ContentControl in a visual tree?▼

Panel holds multiple children in a Children collection with Add and Remove methods, while ContentControl holds a single child via its Content property. Both set the child's Parent reference automatically.

Why does hit testing return null for my custom control?▼

Hit testing returns null when IsVisible, IsHitTestVisible, or IsEffectivelyEnabled is false. Also verify the point coordinates are parent-relative, since MewUI does not translate points before calling child hit tests.

Can I use VisualTree.Visit for external tree traversal code?▼

No, VisualTree.Visit is internal to MewUI and unavailable to external code. Use FindVisualRoot, IsDescendantOf, IsAncestorOf, or manual parent-chain iteration instead.