1

Normally a WPF WrapPanel (Orientation="Vertical") will stack items vertically (and grow vertically) until it runs out of space from the parent container, and then it will "wrap" to the next column.

I want this functionality, but I want to add a hard limit to the number of items in a column. For instance, if my height is 100 and I have 3 items that are 30 pixels high, normally it could fit them all without wrapping. However, say I want to force it to wrap after 2. In that case, I want it to only grow to a height of 60, and wrap the 3rd item into the second column.

Is there something I can do to make this happen?

Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114

2 Answers2

3

Maybe you can do it with the UniformGrid.
Use the Rows property to definie the amount of elements in vertical direction.

HCL
  • 36,053
  • 27
  • 163
  • 213
0

here is a nice little article about the available layout panels in WPF. If one of these does not fit the bill, you might have to build your own custom panel, here is a decent demo.

Muad'Dib
  • 28,542
  • 5
  • 55
  • 68