Question

Is it possible to allow the controls inside a FlowLayoutPanel to be user draggable so that they can be reorganized. If I have a list of labels, I would like to drag and move them around, much like the icons on your desktop. I would like to grab label A and put it in between label B and C.

Another option, is that if there is another container control that allows this out-of-the-box, I would probably prefer it to coding a drag and drop handler for the FLP.

EDIT: I'm using WinForms.

Was it helpful?

Solution

You can use FlowLayoutPanel.SetChildIndex() to reorder controls within it through code.

Or, you can use some drag/drop reordering for an itemscontrol, and change the template to use a flowlayoutpanel for the items. Here's a related question on SO that does the same thing for a wrappanel, but would probably easily work for a flow panel: WPF : Reorder WrapPanel content via drag and drop?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top