Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have elements in an ItemsCollection play a layout animation during drag and drop operations to make room for inserting elements

Here's my scenario. I want to be able to drag and drop elements around in a items collection, and have other elements make way when an item is moved into place... I also want this to be MVVM friendly.

From a high level view it seems to me you should be able to just attach some sort of Interactivity behavior to the items collection that simply gets the layout size of the dragged item, and shuffles elements based on that new layout data, but I'm at a total loss on how to implement something like this.

Other features to consider would be

  • Auto-scroll on scrollviewer edge during drag operations
  • Inserted objects may be of variable sizes

It seems to me I'll need to use a FluidMoveBehavior

like image 920
Firoso Avatar asked Nov 14 '22 18:11

Firoso


1 Answers

Look at the project at http://code.google.com/p/gong-wpf-dragdrop/. It can help you solve your problem. The solution is MVVM based on attaching drag&drop behaviours to UI elements and customizing the way how DragXXX events are handled.

like image 60
Karel Frajták Avatar answered Dec 26 '22 00:12

Karel Frajták