List Items Vertically on a WrapPanel and take advantage of multiple columns

前端 未结 5 1057
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 16:21

I need to list items (all of same size) vertically (with a ScrollViewer). I want the items to spread through x columns if the container is large enough to display

5条回答
  •  悲哀的现实
    2021-01-01 16:52

    The only way to do this with a WrapPanel is to explicitly set the Height.

    It looks like you want the items to be spread out evenly over the columns with the left column having at most one more item than the column to the right. If that is what you are looking for then you'll need to create your own custom panel. Take a look at this to see how to get started. You'll need an ItemWidth and ItemHeight dependency properties and calculate how many columns you can have by using the ItemWidth and available width.

提交回复
热议问题