WPF拖& Drop:如何直接拖动元素? [英] WPF Drag & Drop: How to literally drag an element?

查看:377
本文介绍了WPF拖& Drop:如何直接拖动元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个 ListBox 有些项目,并说我实现该列表的拖放功能。如果我想从该列表框中拖动一个项目,我该如何实际地移动拖动的项目?



我想实现将列表框项目放在鼠标光标下的效果,并可以在窗口中拖动时移动它。遵循这个示例,我得到的是基于的游标更改, DragDropEffects 枚举选项。

解决方案

这通常是使用adorner完成的。请参阅这里为例。


Say I have a ListBox with some items and say I implement drag and drop functionality for that list. If I want to drag an item from that list box, how can I actually move the dragged item?

I want to achieve the effect of having the list box item under my mouse cursor and to be able to move with it as I drag it on the window. By following this example, all I get is a cursor change based on the DragDropEffects enum choice.

解决方案

This is typically done using an adorner. See here for an example.

这篇关于WPF拖& Drop:如何直接拖动元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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