从 TagVisualization 访问 SurfaceWindow

发布于 2024-08-27 01:22:46 字数 135 浏览 3 评论 0原文

我正在寻找一种简单的方法来从我拥有的 TagVisualization 访问我的主 SurfaceWindow。场景是我想将数据从 TagVisualization 传递回 SurfaceWindow。有没有简单的方法可以做到这一点?

谢谢

I'm looking for an easy way to access my main SurfaceWindow from a TagVisualization that I have. The scenario is that I want to pass along data from my TagVisualization back to the SurfaceWindow. Is there an easy way to do this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

喜爱皱眉﹌ 2024-09-03 01:22:46

TagVisualization 继承自 FrameworkElement,因此 Parent 属性可用。您可以按照这种方式攀爬层次结构,直到到达 SurfaceWindow。

华泰

TagVisualization inherits from FrameworkElement, so a Parent property is available. You can climb the hierarchy that way until you get to the SurfaceWindow.

HTH

无需解释 2024-09-03 01:22:46

一般来说,我建议您考虑应用程序的整体架构,因为您在控件之间引入了通常需要的更紧密的耦合。

也就是说,您可以使用 遍历应用程序可视化树VisualTreeHelper

这个堆栈溢出问题有很多关于查找控件的详细信息,特别是 包含 FindVisualParent 辅助方法的答案

Generally, I'd recommend you to think about your overall architecture of your application, since you're introducing a tighter coupling between your controls that is normally desirable.

That said, you can walk your apps visual tree using the VisualTreeHelper

This stack overflow question has a lot of details about finding controls, and especially the answer containing the FindVisualParent helper method

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文