How to control number of items appearing in GridView rows and columns in a Metro Style GridView App?

邮差的信 提交于 2019-12-25 05:08:05

问题


I create GridView app and in the itemspage after binding items with the grid, it appears with 4 rows and 5 columns, when I rotate ScrollViewer to Vertical.

It appears with only one column. How can I control the number of rows and columns?


回答1:


You can control it in many ways depending on your layout which you have not shared. If you want a fixed number - make sure the height/width of your GridView is the correct multiple of the number of columns/rows that you want displayed. For example for a default GridView if you want to have 3 rows you could so something like:

<GridView
    Height="700">
    <GridView.ItemContainerStyle>
        <Style
            TargetType="GridViewItem">
            <Setter
                Property="Height"
                Value="200" />
...


来源:https://stackoverflow.com/questions/10533105/how-to-control-number-of-items-appearing-in-gridview-rows-and-columns-in-a-metro

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