[ 本文适用于编写 Windows 运行时应用的 Windows 8.x 和 Windows Phone 8.x 开发人员。如果你要针对 Windows 10 进行开发,请参阅 最新文档 ]
在邮件文件夹列表中定义一个表示邮件文件夹的项。 此模板可以与具有列表布局的 ListView 结合使用。有关更多模板,请参阅网格布局的项模板和列表布局的项模板。
要使用该模板
要使用该模板,需将 HTML 和 CSS 样式复制到你的项目中。HTML 包含专用于该模板的 ListView。在你复制 HTML 之后,将 ListView 控件的 itemDataSource 设置为你的应用的数据源,并更新模板的 data-win-bind 属性以便它们能使用你的数据。
若要该模板正常工作,请将 win-selectionstylefilled
类分配给你的 ListView。
HTML
<!-- Item template -->
<div id="textListMailFolderTemplate"
data-win-control="WinJS.Binding.Template">
<div class="textListMailFolder">
<h2 data-win-bind="innerText: text"></h2>
</div>
</div>
<!-- ListView -->
<div id="textListMailFolder"
class="win-selectionstylefilled"
style="position: relative; left: -1px; top: 129px; border: none"
data-win-control="WinJS.UI.ListView"
data-win-options="{ itemDataSource: list.dataSource,
itemTemplate: select('#textListMailFolderTemplate'),
layout: { type: WinJS.UI.ListLayout } }">
</div>
CSS
/* overall list dimensions */
#textListMailFolder {
margin-left: 110px;
width: 308px; /*+18 px to account for scrollbar*/
height: 632px;
}
/*-------------------------------------------------------------------------------------------*/
/* textList-mailFolder - used for Mail folder*/
/*-------------------------------------------------------------------------------------------*/
/* style the background color of the filled-selection style items */
.win-selectionstylefilled :not(.win-footprint).win-container {
background-color: transparent;
}
.win-selectionstylefilled .win-container.win-swipe:hover {
background-color: transparent;
}
/* individual item dimensions */
.textListMailFolder {
width: 100%;
height: 40px;
padding: 4px 10px;
overflow: hidden;
}