简体   繁体   English

如何设置win-listview高度? - WinJS

[英]How is win-listview height set? - WinJS

this is driving me up the wall. 这让我起了墙。 I cannot figure out how to make the listview's height automatic. 我无法弄清楚如何使listview的高度自动化。

ie have the listview's height extend in order to occupy all the space it needs and have the outer container offer a overflow-y scroll feature. 即将listview的高度扩展以占用所需的所有空间,并使外部容器提供溢出-y滚动功能。

I cannot seem to find any documentation on this unforuntately. 我似乎无法找到任何关于此的文档。

Help would be great. 帮助会很棒。 Thanks! 谢谢!

ListView controls are 400px tall by default. ListView控件默认为400px高。 That's on line 1421 of the ui-light.css file. 这是在ui-light.css文件的第1421行。 You can override it by adding a rule on your page like: 您可以通过在页面上添加规则来覆盖它,例如:

.win-listview { height: 100%; .win-listview {身高:100%; /* (or you can specify absolutely with something like '600px') */ } / *(或者您可以完全指定'600px'之类的东西)* /}

On this page in the dev center it says... 在开发中心的这个页面上 ,它说......

Setting the ListView control's height 设置ListView控件的高度

The ListView does not dynamically adjust its height to fit your content. ListView不会动态调整其高度以适合您的内容。 For a ListView to render, you must specify an absolute value for its height. 要使ListView呈现,必须为其高度指定绝对值。 The Windows Library for JavaScript style sheets set the ListView control's height to 400 pixels. Windows Library for JavaScript样式表将ListView控件的高度设置为400像素。

From a design standpoint, you probably shouldn't be doing vertical scrolling on a ListView. 从设计的角度来看,您可能不应该在ListView上进行垂直滚动。 They're designed to be laid out horizontally (as are apps in general). 它们被设计成水平布局(一般应用程序也是如此)。 Combining horizontal and vertical scrolling can make for an awkward user experience. 结合水平和垂直滚动可能会带来尴尬的用户体验。 I wrote some articles about this. 我写了一些关于此的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM