本文介绍了WPF 4将可视元素拖放到游标中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF 4应用程序,我想要启用拖放,目前我有一个基本的拖放实现,但我发现,如果,而不是鼠标光标更改将会更好为了表示移动操作,我可以使用我的手指下的图像。



我似乎找不到任何样品或doco,这样的工作开箱即用,所以我假设我必须建立它自定义...任何想法?



我的拖放操作是在自定义用户控件内启动的,所以我需要插入一个视觉元素进入视觉树并让它跟随我的手指,也许我应该在我的主窗口上启用 ManipulationDelta 事件,检查一个布尔值,然后移动项目?



我只是在这一点上提出想法,任何帮助或想法将不胜感激。



干杯,
标记

解决方案

有一个exa mple使用自定义拖动光标。您可以处理事件并更改鼠标光标,但要使用自定义视图,作者创建一个新窗口并更新 QueryContinueDrag


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.

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?

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?

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

Cheers,Mark

解决方案

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将可视元素拖放到游标中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 21:06