开发者

How To Get Global MouseMove And KeyDown Events In Silverlight

开发者 https://www.devze.com 2022-12-15 08:05 出处:网络
Application.Current.RootVisual.KeyDown += Application_KeyDown The above does not work if I\'m on a ChildWindow - that was instantiated in runtime. My question is, how do I get the mousemove or keydo

Application.Current.RootVisual.KeyDown += Application_KeyDown

The above does not work if I'm on a ChildWindow - that was instantiated in runtime. My question is, how do I get the mousemove or keydown event in the Parent Window that hosts this ChildWindow?

Also, I'd rather not change anything in the childwindow (i.e., add an event t开发者_运维知识库hat calls a parent's event directly). I'd just like to get a global keydown event. Is this is a possibility in Silverlight 3?


There isn't a Global Keydown event. You will need to assign the Application_KeyDown to the ChildWindow's KeyDown event when you call the Show method and remove it when the Closed event fires.

0

精彩评论

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

关注公众号