开发者

c# reorganize controls in a FlowLayoutPanel

开发者 https://www.devze.com 2023-01-19 13:56 出处:网络
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

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 开发者_C百科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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消