MouseLeave of the base object runs even if the overlapping object IsHitTestVisible = false

I created a custom popup to decorate my buttons with animated tooltips. I track Button.MouseEnter for a button to decide when to display a popup. I use Button.MouseLeave to determine when to hide the popup.

The problem is Button.MouseLeave is dismissed prematurely if the popup is moved above the mouse cursor (its appearance is animated), despite the fact that I set IsHitTestVisible = false for the popup and all of its visual children.

Is this how WPF is designed to work? I need the MouseLeave to fire only when the cursor moves away from the button itself and is independent of the popup.

thank

+3
source share
1 answer

I believe that the Popup control is actually contained inside the window, so the popup may in some cases go beyond the window. (This is also why pop-up transparency is not supported in Silverlight.)

I believe that although the pop-up control no longer handles hits, the container window is why you lose mouse focus on the button.

, ( ). , WPF . , 100%, .

: WPF . , , , , .

+5

All Articles