Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 x columns

I first tried that :

<ScrollViewer>
    <toolkit:WrapPanel Orientation="Horizontal" ItemHeight="30" ItemWidth="100">
        <Button Content="1" />
        <Button Content="2" />
        <Button Content="3" />
        <Button Content="4" />
        <Button Content="5" />
    </toolkit:WrapPanel>
</ScrollViewer>

Result - The WrapPanel works like I want but my items are ordered from "Left to Right" (not vertically

Then I tried to seet the Orientation of the WrapPanel to "Vertical" :

Result - My items are ordered vertically but not spreaded on multiple columns.

Here is how I'd like items to be rendered :

I'd really like to avoid having to write code monitoring the control size to create/remove columns depending on its size.

like image 672
danbord Avatar asked Jul 05 '12 13:07

danbord


1 Answers

If you set Orientation to Vertical you should also set render height. For example to WrapPanel, Height="150".

like image 105
Zabavsky Avatar answered Sep 29 '22 17:09

Zabavsky