Swap drag items

Aug 11, 2009 at 11:56 AM


Is it possible to have behaviour where drag items are swapped?

For example, I have a grid with four cells.  Each cell has a drag source, a drag item and a textblock.  When I drag a textblock from cell 1 to cell 2, I'd like the textblock in cell2 to swap over into cell1.

Thanks in advance


Aug 12, 2009 at 7:34 PM

Hello Matt,


what do you mean exactly?  When you have 2 dragsources on droptargets, one containing the first, one the second textblock, and all droptargets are valid for all dragsources, they should swap automatically.  Is that what you are looking for? 

If not, you can manipulate what happens after dropping an item by handling the DragSourceDropped-event.


Kind regards,


Aug 13, 2009 at 8:37 AM

Hi Kev,

Thanks for the reply.  I managed to get the behaviour I was looking for in the end by using a WrapPanel (previously I had been using a Grid).

The software is great by the way.