in WPF when using VisualTreeHelper.HitTest even hidden elements are found. To skip these elements and return the result only for visible ones, I created HitTestFilter as follows:
This filter does its job, but I like to know what WPF HitTesting does by default in this case? Does he use a similar filter? Are there other possibly better options for this?
To clarify the short description:

The image has
- Layout container as root element
- Button 1, which is visible
- Above Button1 is Button2, which is invisible
If I get such a layout and make a mouseclick in the green zone of Button2, WPF skips Button2 and the click event appears on Button1.
If I do a manual HitTesting without the filter described earlier, I get Button2 as an example.
So the question is, what is the default WPF behavior / filter?
Thanks in advance for any suggestions.
sebhaub
source share