SuperAPI AI 工具集

navigating-mewui-tree

通用与其它

查看项目

更新于 10-15 20:12

技能介绍

用途:该技能用于遍历和操作 MewUI 可视化树,适用于理解元素层级、查找父子元素、实现 IVisualTreeHost 等场景。

主要能力:资料给出元素层级结构,Element 为基类,UIElement 处理输入、可见性与焦点,FrameworkElement 处理尺寸、边距与对齐;Panel 支持多子元素(StackPanel、Grid、Canvas、DockPanel),Control 为带主题元素(Button、Label、TextBox),ContentControl 为单子元素(Window),Border 为装饰器。父子关系方面,每个元素有一个 Parent;Panel 通过 Add/Remove 管理子元素并设置 Parent,Children 为 IReadOnlyList<Element>;ContentControl 用 Content、Border 用 Child 设置单子元素。

使用方式:可用 element.FindVisualRoot() 查找可视化根(通常为 Window);用 IsDescendantOf/IsAncestorOf 判断祖先关系;可自行实现 FindAncestor<T> 沿 Parent 向上查找指定类型祖先。坐标变换可用 TransformToAncestor 和 TranslatePoint,鼠标位置用 MouseEventArgs.Position。

限制:VisualTree.Visit() 存在但为 internal,外部代码应使用 FindVisualRoot/IsDescendantOf;IVisualTreeHost 为 internal API,仅内部实现;OnVisualRootChanged 在元素加入或离开树时调用。命中测试另见 hit-testing.md。资料未提供安装命令、收费、平台或效果信息。