navigating-mewui-treelisted
Install: claude install-skill christian289/dotnet-with-claudecode
## Element Hierarchy
```
Element (base)
└─ UIElement (input, visibility, focus)
└─ FrameworkElement (sizing, margin, alignment)
├─ Panel (multi-child: StackPanel, Grid, Canvas, DockPanel)
├─ Control (themed elements: Button, Label, TextBox)
│ ├─ ContentControl (single child: Window)
│ └─ Border (decorator)
└─ ...
```
---
## Parent-Child Relationships
```csharp
// Every element has one parent
Element? parent = element.Parent;
// Multi-child (Panel)
panel.Add(child); // Sets child.Parent = panel
panel.Remove(child); // Sets child.Parent = null
panel.Children; // IReadOnlyList<Element>
// Single-child (ContentControl, Border)
contentControl.Content = child; // Element? type, sets child.Parent
border.Child = child; // UIElement? type
```
---
## Tree Traversal
```csharp
// Find visual root (usually Window)
Element? root = element.FindVisualRoot();
// Check ancestry
bool isChild = element.IsDescendantOf(ancestor);
bool isParent = element.IsAncestorOf(descendant); // Also available
// Find ancestor of type
static T? FindAncestor<T>(Element element) where T : Element
{
for (var cur = element.Parent; cur != null; cur = cur.Parent)
if (cur is T match) return match;
return null;
}
```
Note: `VisualTree.Visit()` exists but is `internal` - use FindVisualRoot/IsDescendantOf for external code.
---
## IVisualTreeHost (Internal)
Interface for elements with children (internal API):
```csharp
intern