我如何知道哪个 Silverlight 弹出窗口(或 ChildWindow)位于最顶层?
我正在尝试在 Silverlight 应用程序中进行点击测试以查找鼠标光标下的元素。
通常,VisualTreeHelper.FindElementsInHostCooperatives
适用于此。如果有一个弹出窗口打开,我需要将弹出窗口传递给命中测试方法。如果打开了多个弹出窗口,我需要确定要传入的正确(最上面)弹出窗口。
有没有可靠的方法来确定哪个 Popup
是最上面的?我在一个可能在打开弹出窗口后加载的程序集中执行此操作,因此我不能依赖于跟踪它们打开的顺序。
感谢您的任何帮助。
I am trying to hit test in Silverlight applications to find the elements under the mouse cursor.
Normally VisualTreeHelper.FindElementsInHostCoordinates
works for this. If there is a Popup
open I need to pass in the popup to the hit testing method. If there are multiple popups open, I need to determine the correct (topmost) popup to pass in.
Is there any reliable way to determine which Popup
is topmost? I'm doing this in an assembly that may be loaded after the Popup
s have been opened, so I can't rely on tracking the order in which they are opened.
Thanks for any assistance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来新的 VisualTreeHelper.GetOpenPopups 调用按从下到上的顺序返回打开的 Popup(或者最近打开到最近打开的?)。这就是我所需要的。
发布此答案以防其他人遇到同样的问题。
It looks like the new
VisualTreeHelper.GetOpenPopups
call returns the openPopup
s in order from bottom to top (or least recently to most recently opened?). So that does what I need.Posting this answer in case anyone else runs into the same issue.