WPF 4 拖放视觉元素作为光标 [英] WPF 4 Drag and Drop with visual element as cursor
问题描述
我有一个 WPF 4 应用程序,我想用它来启用拖放功能,目前我让它使用基本的拖放实现,但我发现如果而不是更改鼠标光标会更好为了表示移动操作,我可以使用手指下方的图像.
I have a WPF 4 app which I want to enable drag and drop with, currently I have it working with a basic drag and drop implementation, but I have found that it would be much better if, instead of the mouse cursor changing over to represent the move operation, I could use an image underneath my finger.
我的拖放操作是在自定义用户控件内启动的,因此我需要将一个可视元素插入到可视化树中并让它跟随我的手指移动,也许我应该启用 ManipulationDelta
我的主窗口上的事件,检查一个布尔值然后移动项目?
My drag and drop operation is initiated inside a custom user control, so I will need to insert a visual element into the visual tree and have it follow my finger around, perhaps I should enable the ManipulationDelta
event on my main window, check for a boolean then move the item around?
推荐答案
有一个使用自定义拖动光标的示例 在 Jaime Rodriguez msdn 博客.您可以处理 GiveFeedback
事件并更改鼠标光标,但要使用自定义 Visual,作者会创建一个新窗口并更新 QueryContinueDrag
.
There is an example of using a custom drag cursor at Jaime Rodriguez msdn blog. You can handle the GiveFeedback
event and change the mouse cursor, but to use a custom Visual the author creates a new Window and updates the position on QueryContinueDrag
.
这篇关于WPF 4 拖放视觉元素作为光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!