[英]Drag-Drop a Control between multiple canvas
Greetings, 问候,
I need to be able to drag and drop items that's contained in a Border. 我需要能够拖放Border中包含的项目。 So far I managed to find the border on the MouseLeftButtonDown event.
到目前为止,我设法在MouseLeftButtonDown事件上找到了边框。 Now I wish for the item to move with the mouse when I have my mousebutton down.
现在,当我按下鼠标按钮时,希望该物品随鼠标一起移动。
I assume this can be done by simple settinga bool "dragging" to true when the item is clicked and then handle the moving in the MouseMove event. 我认为可以通过简单地将布尔值“拖动”为true来实现,方法是单击该项目然后在MouseMove事件中处理移动。
But I can't seem to figure out how to move the item. 但我似乎无法弄清楚如何移动该物品。 Border doesn't have a property as Position or Location.
Border没有位置或位置属性。 Is there any way I can achieve what I want?
有什么办法可以实现我想要的?
Perhaps there are controls for it that I dont know of? 也许有我不知道的控件?
Bit more background information: 更多背景信息:
I'm showing multiple columns (each column is a new canvas) with rows in it. 我正在显示其中包含行的多个列(每个列是一个新的画布)。 Each row and canvas represent a cell.
每行和画布代表一个单元格。 In a some cells I have a border containing a textblock with information.
在某些单元格中,我有一个边框,其中包含带有信息的文本块。 Upon clicking this border I wish for it to be bound to my mouse and move where I move my mouse.
单击此边框后,我希望将其绑定到鼠标并移动到我将鼠标移动到的位置。
I would recommend you use the Silverlight Toolkit which contains a framework for doing this sort of drag and drop work. 我建议您使用Silverlight工具包 ,其中包含用于执行此类拖放工作的框架。 Once installed open the documentation and lookup the
PanelDragDropTarget
control. 安装完成后,打开文档并查找
PanelDragDropTarget
控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.