WPF 4拖放视觉元素作为光标 [英] WPF 4 Drag and Drop with visual element as cursor

查看:211
本文介绍了WPF 4拖放视觉元素作为光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF 4应用程序,我想启用拖放使用,目前我有一个基本的拖放工作拖放实现,但是我发现,这将是如果更好,而不是鼠标光标改变在重新present移动操作,我可以用一个形象我的手指下面。

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.

我似乎无法找到任何样品或DOCO具有此工作开箱即用,所以林假设我要去必须建立它的自定义...任何想法?

I cannot seem to find any samples or doco that has this working out of the box, so Im assuming Im going to have to build it custom... any ideas?

我拖放一个自定义用户控件内开始运作,所以我需要插入一个视觉元素插入可视化树,让它跟着我的手指周围,也许我应该让 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?

我只是抛出的想法,在这一点上各地,任何帮助或想法将不胜AP preciated。

Im just throwing ideas around at this point, any help or ideas would be greatly appreciated.

干杯, 马克

推荐答案

有使用自定义的拖动光标的在海梅·罗德里格斯MSDN博客。您可以处理的<一个href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.givefeedback%28v=vs.85%29.aspx"相对=nofollow> GiveFeedback在 事件,改变鼠标光标,而是使用自定义视觉笔者创建了一个新的窗口和更新<一个位置href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.querycontinuedrag%28v=vs.85%29.aspx"相对=nofollow> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆