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 开发者_Go百科order in which they are opened.
Thanks for any assistance.
It looks like the new VisualTreeHelper.GetOpenPopups
call returns the open Popup
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.
精彩评论