I have 2 UserControls: uc1 and uc2
On uc1.MouseOver, uc2 increases in size. On uc1.MouseLeave, uc2 returns to the original size.
On uc1.MouseLeftButtonUp, a popup is opened. However, when the popup is then closed, uc1.MouseLeave is not triggered, so uc2 doesn't return to it's original size.
A solution would be to have uc2 also subscribe to uc1.MouseLeftButtonUp, and execute the same code as on uc1.MouseLeave, but this is not a very elegant solution, as I have to repeat this for everything that subscribes to uc1.Mouse开发者_C百科Leave.
Is there a way to force the MouseLeave event programmatically?
Consider making a method in your .cs file that your mouseleave (and mouseleftbuttonup) event calls.
Try this,
subscribe to the events on the MainPage.xaml.cs (even the popup close button click) and after each event ends you put this on the end of the event handling code:
e.Handled = true;
精彩评论