FlowLayout ItemsControl in WPF

落爺英雄遲暮 提交于 2019-12-24 02:35:14

问题


I need a really simple ItemsControl actually. I want all the items in the collection to be put left to right and when it's not enough space to fit the next element, it should be put on the next line.

So basically like FlowLayout in Java Swing, or the normal Icon folder view in Windows.

I can't believe this is not built in, but for some reason I can't find it.


回答1:


Have a look at these:

http://msdn.microsoft.com/en-us/library/ms750564%28v=vs.85%29.aspx

Specifically the WrapPanel

Edit:

The ItemsControl control has a ItemsPanel Property which you canset to use a WrapPanel:

http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemspanel.aspx



来源:https://stackoverflow.com/questions/5988876/flowlayout-itemscontrol-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!