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
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.
精彩评论