Hi,
I have a control for which I activate a visual state on Mouse Enter to show it and activate another one to hide it in Mouse Leave.
The control has a ContextMenu on it and when I trigger the context menu using the right click and close the context I force a call to the visual state to hide the control but here's the confusion. If I go back on the control (MouseEnter) it does nothing. I have to leave it and enter it again so the normal process works. Why the first time it doesn't work but the second time ? This is happening only if the mouse is still on the area of the control when closing the context menu. If the mouse is outside it works as normal.
I do check if the context menu is open in the MouseLeave of the control so I do not activate the state to hide it since when getting in the context menu I'm leaving the control.
I'll try to make a video to show this if it's not clear
Meanwhile here's the code :
private void CallCustomersButton_MouseEnter(object sender, MouseEventArgs e) { VisualStateManager.GoToState(this, "ShowCustomers", true); } private void CallCustomersButton_MouseLeave(object sender, MouseEventArgs e) { if(!lstCustomers.ContextMenu.IsOpen) VisualStateManager.GoToState(this, "ShowCustomersNormal", true); } private void CustomersContextMenu_Closed(object sender, RoutedEventArgs e) { VisualStateManager.GoToState(this, "ShowCustomersNormal", true); }