开发者

Force a mouse event in Silverlight 3

开发者 https://www.devze.com 2022-12-08 00:40 出处:网络
I have 2 UserControls: uc1 and uc2 On uc1.MouseOver, uc2 increases in size. On uc1.MouseLeave, uc2 returns to the original size.

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;

0

精彩评论

暂无评论...
验证码 换一张
取 消