问题
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