how to make uniformgrid vertically

六月ゝ 毕业季﹏ 提交于 2019-12-18 18:53:39

问题


I'm using UniformGrid and it's making the items display horizontally. Is there a way to make it display vertically?

<ListView.ItemsPanel>
    <ItemsPanelTemplate>
        <UniformGrid Columns="3" />
    </ItemsPanelTemplate>
</ListView.ItemsPanel>

Any help would be greatly appreciated.


回答1:


The WPF UniformGrid layout is horizontal only, e.g.:

1 2 3
4 5 6
7 8 9

Perhaps you could use a WrapPanel instead and just set the ItemHeight and ItemWidth to your desired grid size and set the Orientation to Orientation.Vertical.

Or you could create a derived UniformGrid to handle Orientation, there is a good example on MSDN.

This one will display:

1 4 7
2 5 8
3 6 9

Is this what you mean?




回答2:


I'm a bit late to the party - but for anyone else searching for a solution, the following works.

<UniformGrid Columns="1" />


来源:https://stackoverflow.com/questions/13944322/how-to-make-uniformgrid-vertically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!