Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法注册全局事件处理程序以在 Silverlight 应用程序中捕获鼠标事件?我想避免订阅每个 FrameworkElement 的鼠标事件处理程序并找到更优雅的解决方案(冒泡事件)。谢谢
MouseMove 是 Silverlight 中的冒泡事件;您是否尝试在 Window 级别捕获它?
所有鼠标事件都是冒泡事件,因此在它的表面上,您应该能够将事件处理程序附加到根UserControl或Page元素并获取事件。
UserControl
Page
然而,许多控件都用于鼠标事件并自己处理这些事件。在这些情况下,这些事件不会再冒泡。