【问题标题】:How To Get Global MouseMove And KeyDown Events In Silverlight如何在 Silverlight 中获取全局 MouseMove 和 KeyDown 事件
【发布时间】:2010-01-05 20:39:36
【问题描述】:

Application.Current.RootVisual.KeyDown += Application_KeyDown

如果我在 ChildWindow 上,上述内容不起作用 - 这是在运行时实例化的。我的问题是,如何在承载此 ChildWindow 的父窗口中获取 mousemove 或 keydown 事件?

另外,我宁愿不更改子窗口中的任何内容(即,添加一个直接调用父事件的事件)。我只想获得一个全局 keydown 事件。这在 Silverlight 3 中有可能吗?

【问题讨论】:

    标签: silverlight events parent childwindow routed


    【解决方案1】:

    没有全局 Keydown 事件。您需要在调用 Show 方法时将 Application_KeyDown 分配给 ChildWindow 的 KeyDown 事件,并在 Closed 事件触发时将其删除。

    【讨论】:

    • Silverlight 4 和 5 仍然如此吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    • 2012-09-24
    • 2011-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多