问题
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