如何控制 Metro 风格 GridView 应用程序中 GridView 行和列中出现的项目数? [英] How to control number of items appearing in GridView rows and columns in a Metro Style GridView App?

查看:25
本文介绍了如何控制 Metro 风格 GridView 应用程序中 GridView 行和列中出现的项目数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了 GridView 应用程序,在将项目与网格绑定后的项目页面中,当我将 ScrollViewer 旋转到垂直时,它显示为 4 行和 5 列.

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?

推荐答案

您可以通过多种方式控制它,具体取决于您尚未共享的布局.如果你想要一个固定的数字 - 确保你的 GridView 的高度/宽度是你想要显示的列/行数的正确倍数.例如对于默认的 GridView,如果你想要 3 行,你可以这样:

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" />
...

这篇关于如何控制 Metro 风格 GridView 应用程序中 GridView 行和列中出现的项目数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆