如何让 ItemsCollection 中的元素在拖放操作期间播放布局动画,以便为插入元素腾出空间
这是我的场景。我希望能够在项目集合中拖放元素,并在项目移动到位时让其他元素让路...我也希望这对 MVVM 友好。
从高层次的角度来看,在我看来,您应该能够将某种交互行为附加到项目集合中,该集合只需获取拖动项目的布局大小,并根据新的布局数据对元素进行洗牌,但我完全不知道如何实现这样的事情。
其他需要考虑的功能是
- 在拖动操作期间在滚动查看器边缘自动滚动
- 插入的对象可能具有可变大小
在我看来我需要使用 FluidMoveBehavior
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请访问 http://code.google.com/p/gong-wpf 查看该项目-拖放/。它可以帮助您解决您的问题。解决方案是基于将拖放行为附加到 UI 元素并自定义 DragXXX 事件处理方式的 MVVM。
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.