Image overlay (album) template (HTML)
[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]
Defines an item that shows album info: an image of the album, info about the album, and the artist. This template is for use with a ListView that has a grid layout. For additional templates, see Item templates for grid layouts and Item templates for list layouts.
To use the template
To use the template, copy the HTML and the CSS styles into your project. The HTML includes a ListView that's designed to be used with the template. After you copy the HTML, set the ListView control's itemDataSource to your app's data source and update the template's data-win-bind attributes so they work with your data.
HTML
<!-- Item template -->
<div id="imageOverlayAlbumTemplate"
data-win-control="WinJS.Binding.Template">
<div class="imageOverlayAlbum">
<img class="imageOverlayAlbumImage"
data-win-bind="src: imageUrl"/>
<div class="imageOverlayAlbumOverlay">
<h3 class="imageOverlayAlbumTextAlbum"
data-win-bind="innerText: textAlbum">
</h3>
<div class="imageOverlayAlbumTextArtist"
data-win-bind="innerText: textArtist">
</div>
</div>
</div>
</div>
<!-- ListView -->
<div id="imageOverlayAlbum"
data-win-control="WinJS.UI.ListView"
data-win-options="{ itemDataSource: list.dataSource,
itemTemplate: select('#imageOverlayAlbumTemplate'),
layout: { type: WinJS.UI.GridLayout } }">
</div>
CSS
/* overall list dimensions */
#imageOverlayAlbum
{
width: 1366px;
height: 578px;
}
/*-------------------------------------------------------------------------------------------*/
/* imageOverlay-album - used in Media player album view */
/*-------------------------------------------------------------------------------------------*/
/* starting margin */
#imageOverlayAlbum .win-horizontal.win-viewport .win-surface
{
margin: 0px 115px;
}
/* individual item dimensions */
.imageOverlayAlbum
{
width: 130px;
height: 130px;
overflow: hidden;
display: -ms-grid;
-ms-grid-columns: 1fr;
-ms-grid-rows: 1fr;
}
/* image */
.imageOverlayAlbum .imageOverlayAlbumImage
{
width: 100%;
height: 100%;
overflow: hidden;
}
/* overlay properties */
.imageOverlayAlbum .imageOverlayAlbumOverlay
{
-ms-grid-row-align: end;
background-color: rgba(0,0,0,0.65);
height: 50px;
overflow: hidden;
padding: 0px 10px 0px 10px;
}
/* text line 1 */
.imageOverlayAlbum .imageOverlayAlbumOverlay .imageOverlayAlbumTextAlbum
{
margin-top: 5px;
color: rgb(255,255,255);
width: 110px;
height: 20px;
white-space: nowrap;
overflow: hidden;
}
/* text line 2 */
.imageOverlayAlbum .imageOverlayAlbumOverlay .imageOverlayAlbumTextArtist
{
color: rgba(255,255,255,0.49);
width: 110px;
height: 20px;
white-space: nowrap;
overflow: hidden;
}