I have a UserControl that listens to it's own MouseLeave in order to change it's background color and some of it's children visibility. The children that should lose visibility, also listen their own MouseLeave in order to change their background color.
A scenario in which everything works is this:
- Move mouse into UserControl.
- Move mouse into Child.
- Move mouse out of Child into UserControl.
The problematic scenario is this:
- Move mouse into UserControl.
- Move mouse into Child.
- Move mouse out of Child, not into the UserControl, but directly outside of it.
This scenario happens all the time since the Child is located at the very edge of the UserControl. Note that not only the UserControl's MouseLeave doesn't fire, but neither does the Child's MouseLeave.
In order to find out whether the mouse has actually left the area in this case, I must listen to MouseEnter of other controls, and then notify the UserControl and Child, but I really want to avoid this solution, since it is ugly and not OOPish.
Also, the Child MUST be located at the very edge of the UserControl, and cannot move.
Can anyone think of a neat solution to the problem?