我如何知道哪个 Silverlight 弹出窗口(或 ChildWindow)位于最顶层?

发布于 2024-09-18 11:31:54 字数 301 浏览 1 评论 0原文

我正在尝试在 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 Popups have been opened, so I can't rely on tracking the order in which they are opened.

Thanks for any assistance.

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

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

发布评论

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

评论(1

喜爱纠缠 2024-09-25 11:31:55

看起来新的 VisualTreeHelper.GetOpenPopups 调用按从下到上的顺序返回打开的 Popup(或者最近打开到最近打开的?)。这就是我所需要的。

发布此答案以防其他人遇到同样的问题。

It looks like the new VisualTreeHelper.GetOpenPopups call returns the open Popups 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.

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