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.
我的视图是用 a 建立的TreeListView,它的内容是由数据模板生成的。我现在需要在我的视图中处理它们可能附加到的任何视觉元素上的所有 mousemove/mouseup 事件。
TreeListView
有没有办法设置一个事件处理程序,所以它会捕获我的所有事件,不管我的 mouseup 是在特定的树项目上、树上,还是在我的主视图上?
这个有可能。大多数路由事件在 WPF 中都有一个 Preview 事件,您PreviewMouseUp可以PreviewMoueDown在View.
PreviewMouseUp
PreviewMoueDown
View