在WrapPanel上垂直列出项目并利用多个列

dan*_*ord 16 silverlight wpf xaml wrappanel scrollviewer

我需要垂直列出项目(全部大小相同)(使用ScrollViewer).如果容器足够大以显示x列,我希望项目通过x列传播

我第一次尝试:

<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>
Run Code Online (Sandbox Code Playgroud)

结果 - WrapPanel的工作方式与我想的一样,但我的项目是从"从左到右"排序的(不是垂直的

然后我尝试将WrapPanel的Orientation设置为" Vertical ":

结果 - 我的项目是垂直排序但未在多列上展开.

以下是我想要呈现的项目:

我真的想避免编写监视控件大小的代码来创建/删除列,具体取决于它的大小.

Zab*_*sky 10

如果设置OrientationVertical,则还应设置渲染高度.例如WrapPanel,Height="150".