I have two ListBox in WPF application. One is the source second is the destination. I took the help from the article http://dotnetslackers.com/ADO_NET/re-191632_Generic_WPF_Drag_and_Drop_Adorner.aspx
Now I have managed to perform the drag and drop.
Now I have one feature to implement in which if we drop any item over an existing one, it will replace the existing item with the current dragged item.
Please guide.
You may want to look at Gong Solutions Drag/Drop for WPF, the guide it uses an adorner and should be able to show you how to remove the old item and add a new one, as #kenny suggested.
Related
I am very new to WPF and I've tried to find the guides and tutorials about this but haven't found exactly I wanted.
This post has been the closest, a solution for moving an item between two different windows (in the same project). However this limits any other drag and drop features you want to do (e.g. within a canvas).
In a similar fashion, I want to move something (an image, within a listbox specifically) from one app to another (when both are running at the same time).
Any help or tips would be appreciated, thank you!
I need to drag out a cell from a datagridview to desktop, once that happens, I need to find out the directory in where it was dragged into and in which row the cell was. How can I do this? Thanks!
There is a codeproject article designed for a different purpose but it implements the drag feature in a datagrid view. So, I suggest that you check it out. Here 's the link.
I am looking for WPF MVVM solution to drag and drop within as well as accross different listboxes.
Drag and Dropping Within Listboxes would update the sequence or Order.
I came across the Gong Soloution one which unfornately does not support both.
Also dragging something off (into nowhere) a listbox would remove the item would be really nice to have.
I would highly recommend looking into Bea Stollnitz's article on Drag/Drop. If her drag/drop code doesn't do what you need, it is very easy to add on to
I'd like to achieve the following and was looking for a sample/tutorial but couldn't really find anything:
I have C# Winforms application, which has multiple Forms within the same process. I'd like to be able to drag & drop items within and between forms and would like to provide some custom painted visualization of the item being dragged.
For example, my IM app shows the effect that I'd like to achieve:
Thanks,
Tom
You actually physically have to drag a control with the mouse.
For example: http://blogs.msdn.com/b/adamroot/archive/2008/02/19/shell-style-drag-and-drop-in-net-wpf-and-winforms.aspx
Recently I needed to add drag & drop functionality to a Silverlight application. Can anyone recommend a good drag & drop control?
I created a Drag/Drop controller that I think works really well. I have been using this technique for a while, and I have been very happy with it.
http://houseofbilz.com/archive/2009/02/10/drag-and-drop-with-silverlight.aspx
Here is a link to the best one I have found so far: http://nickssoftwareblog.com/2008/10/07/silverlight-20-in-examples-part-drag-and-drop-inside-out/
The code is available as a download from the blog post, although you have to rename it to a .zip: http://nickssoftwareblog.files.wordpress.com/2008/10/genericdragdropzip.doc
You can try Blacklight Controls which have a really neat drag-dock panel control. Here's a link to a blog describing how it works.
I recommend the Silverlight Toolkit for dragging and dropping elements within the same application.
It already has been updated for Silverlight 5.
I am guessing you have already found a solution by now. But here is a solution I wrote and am currently using which is very flexible and easy to use: http://sl4dragdrop.codeplex.com/
It works on SL5 very well, all you have to do is add dependency properties on the items or itemscontrol on which you want to enable dragging or dropping.
By default, that is enough. But if you want to customize parts of drag/drop, it gives you interfaces to implement that can control things like Element to drag, Which element to drag from, What image to show while dragging etc.
I have recently refined it a bit and will be posting an update soon after some more testing.