WPF:如何在拖动 ListView 项目时允许在 ListView 中使用鼠标滚轮滚动?
我已经在 WPF 应用程序的 ListView
中实现了拖放。 可以将项目拖放到 ListView
内部,也可以拖放到 ListView
旁边的 TreeView
中。
目前,我已将其设置为当您拖动到 ListView 底部时,它会自动向下滚动列表。
我想知道的是,是否有任何方法可以在拖动项目时使用鼠标滚轮滚动 ListView
? 当我拖动时,鼠标滚轮事件似乎没有被触发。
I have implemented drag and drop in a ListView
in my WPF application. Items can be dragged and dropped inside the ListView
, and also into a TreeView
that is beside the ListView
.
Currently, I have it set up so that when you drag to the bottom of the ListView
, it automatically scrolls down the list.
What I'd like to know is if there's any way to be able to scroll through the ListView
with the mouse wheel while I'm dragging its items? It seems like the mouse wheel events aren't being fired while I'm dragging.
DragDrop.DoDragDrop(...)
之前创建(并启动)鼠标钩子助手DoDragDrop()< 之后停止(处置)鼠标钩子助手/code> 操作
注意:始终停止鼠标钩子助手,因为它可以在窗口关闭时冻结应用程序(我在 XP 上看到它)。
这里你可以找到一个MouseHook,采用它(我发现错误:))或类似的东西。
DragDrop.DoDragDrop(...)
DoDragDrop()
operationNote: always stop mouse hook helper, because it can freeze application when it dispose on Window close (I see it on XP).
here you can find one MouseHook, adopt it (I found bug:)) or something like it.