从 TagVisualization 访问 SurfaceWindow
我正在寻找一种简单的方法来从我拥有的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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
一般来说,我建议您考虑应用程序的整体架构,因为您在控件之间引入了通常需要的更紧密的耦合。
也就是说,您可以使用 遍历应用程序可视化树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