I want to add a hover effect for a WPF-Control.
For this, I created a Style-Trigger that changes the Background
-Brush of the control if IsMouseOver
is true. This works fine, however if I open a ContextMenu
from the control, IsMouseOver
becomes false and the hover effect stops until the ContextMenu
is closed.
I also tried a combination of MouseEnter
and MouseLeave
, but with this, there is the same behaviour. If the context menu` is opened, MouseLeave will be fired.
I understand why I can not do it like this, but I don't see a nice way to solve my requirement. Has anyone did already something like this?