开发者

How can I tell which Silverlight Popup (or ChildWindow) is topmost?

开发者 https://www.devze.com 2023-01-15 19:03 出处:网络
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 nee

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 开发者_Go百科order in which they are opened.

Thanks for any assistance.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消