[ 本文适用于编写 Windows 运行时应用的 Windows 8.x 和 Windows Phone 8.x 开发人员。如果你要针对 Windows 10 进行开发,请参阅 最新文档 ]
在 ListView 中定义一个为 SemanticZoom 提供缩小的字母顺序列表的项目。 此模板可以与具有网格布局的 ListView 结合使用。有关更多模板,请参阅网格布局的项模板和列表布局的项模板。
要使用该模板
要使用该模板,需将 HTML 和 CSS 样式复制到你的项目中。HTML 包含专用于该模板的 ListView。
HTML
<!-- Item template -->
<div id="semanticZoomTemplate" data-win-control="WinJS.Binding.Template">
<div class="semanticZoom">
<h2 data-win-bind="innerText: text"></h2>
</div>
</div>
<!-- ListView -->
<div id="semanticZoomAlpha"
data-win-control="WinJS.UI.ListView"
data-win-options="{ itemTemplate: select('#semanticZoomTemplate'), layout: { type: WinJS.UI.GridLayout } }">
</div>
CSS
/* overall grid dimensions */
#semanticZoomAlpha {
position: absolute;
top: calc(50% - 210px); /* vertically center tiles */
left: calc(50% - 630px); /* horizontally center tiles */
width: 1260px;
height: 430px;
}
/*-------------------------------------------------------------------------------------------*/
/* semantic zoom alpha template */
/*-------------------------------------------------------------------------------------------*/
#semanticZoomAlpha .win-container {
margin: 5px 10px;
}
/* individual item */
.semanticZoom {
color: white;
width: 140px;
height: 52px;
overflow: hidden;
padding: 9px 15px;
white-space: nowrap;
display: -ms-flexbox;
-ms-flex-pack: end;
-ms-flex-direction: column;
background-color: rgba(70,23,180,1.0);
}
/* High Contrast */
@media (-ms-high-contrast) {
/* add a border to the item */
.semanticZoom {
padding: 8px;
color: ButtonText;
background-color: ButtonFace;
border: 2px solid ButtonText;
}
/* outline shown on mouse hover */
#semanticZoomAlpha .win-container:hover {
outline: 3px solid Highlight;
}
/* use high contrast colors for hover state */
.semanticZoom:hover {
background-color: Highlight;
color: HighlightText;
border-color: HighlightText;
}
/* style the focus visual for edge-to-edge items */
#semanticZoomAlpha .win-focusedoutline {
outline-color: WindowText;
}
}