views:

51

answers:

1

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.

A: 

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.

Greg