WPF:通过拖放重新排序WrapPanel内容? [英] WPF : Reorder WrapPanel content via drag and drop?
问题描述
我正在寻找一种通过拖放方式重新排序WPF WrapPanel的内容(项目)的方法。我只想点击一个项目并将其拖动到一个新的位置。
I am looking for a way to reorder the content (items) of a WPF WrapPanel via drag and drop. I just want to click on an item and drag it to a new position.
据我了解,这是一个非常常见的任务,我想知道有人已经这样做了任何想法如何实现这个功能。
To my understanding this is a very common task and I wonder I someone already did this or has any idea how to implement this functionality.
我已经做了谷歌搜索,但没有发现任何东西。也许比我预想的要困难。
I did a google search already but found nothing. Maybe it is more difficult than I expected.
推荐答案
我写了一个可能有帮助的库:默认行为是允许重新在同一控制范围内:
I've written a library which may help: default behaviour is to allow re-ordering within the same control:
http://code.google.com/p/gong-wpf-dragdrop/
啊我注意到你只是在说一个WrapPanel :您需要使用带有WrapPanel的ItemsControl:
Ah I notice you're talking about just a WrapPanel: you'll need to use an ItemsControl with a WrapPanel:
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
这篇关于WPF:通过拖放重新排序WrapPanel内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!