FlowLayout ItemsControl in WPF

Øyvind Bråthen picture Øyvind Bråthen · May 13, 2011 · Viewed 8.2k times · Source

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.

Answer

Till picture Till · May 13, 2011

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