简体   繁体   English

WPF网格鼠标事件

[英]WPF Grid Mouse Events

I was wondering, what is the best way to capture a mouse Event inside of a wpf Grid ? 我想知道,在wpf Grid内捕获鼠标事件的最佳方法是什么?

I wanted to Capture an event when the mouse wheel is either scrolled up or down in the Grid . 当鼠标滚轮在Grid向上或向下滚动时,我想捕获一个事件。

I tried to create a custom grid, but that kind of didn't work. 我试图创建一个自定义网格,但是这种方法不起作用。

Any ideas? 有任何想法吗?

您可以挂钩MouseWheel事件,或者,如果要继承,则可以重写OnMouseWheel方法

我在网格内处理了鼠标事件,方法是在其中放置一个空白Label,这样它将在整个Grid中展开,然后提供一个处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM