Sort listbox by dragging items: Xaml Fluidlayout or codebehind?
I'm looking into ways of resorting a listbox by dragging the items in it to a different place in the list. I've looked into the new fluidlayout开发者_如何学编程 technology and though it looks very useful, there is also very little documentation.
Has anybody got experiences with this, and also: can the sorting by dragging the items be achieved by mostly xaml/Blend only or code behind?
I've seen Bea Stollnitz article on this but I'm trying to find more alternatives.
At some level you're going to need to use some code for event handlers and manipulating the collection data (assuming you have some type of bound data). Using States with Fluid Layout might be able to help with making the UI look good but you still need the drag and drop logic to drive it. The trick is in how well you hide that code so that it's easy to use from any control in XAML without having to use code-behind for that particular view.
If you use Bea's code as a starting point you can probably abstract out all of the logic that's in the code behind to either a custom control (i.e. DraggableListBox) or a helper class with attached properties that you can set on existing controls.
精彩评论