Text (album track) 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 contains the track number and title of an album track. 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.

For the template to work properly, assign the win-selectionstylefilled class to your ListView.

HTML

<!-- Item template -->
<div id="textAlbumTrackTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="textAlbumTrack">
    <h2 class="textAlbumTrackNumber" 
        data-win-bind="innerText: index"> 
    </h2>
    <h2 class="textAlbumTrackTitle" 
        data-win-bind="innerText: text">
    </h2>
  </div>
</div>

<!-- ListView -->
<div id="textAlbumTrack"
    class="win-selectionstylefilled" 
    style="position: relative; left: -1px; top: 131px; border: none"
    data-win-control="WinJS.UI.ListView"
    data-win-options="{ itemDataSource: list.dataSource, 
        itemTemplate: select('#textAlbumTrackTemplate'), 
        layout: { type: WinJS.UI.GridLayout } }">
</div>

CSS

/* overall list dimensions */
#textAlbumTrack {
    width: 1366px;
    height: 538px;
}

/*-------------------------------------------------------------------------------------------*/
/* text-track - used for Media player album tracks                                           */
/*-------------------------------------------------------------------------------------------*/

/* 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;
}

/* style the focus visual for edge-to-edge items */
#textAlbumTrack .win-focusedoutline {
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    left: 2px;
    top: 2px;
    z-index: 5;
}

/* starting margin */
#textAlbumTrack .win-horizontal.win-viewport .win-surface {
    margin: 0px 100px;
}

#textAlbumTrack .win-horizontal.win-viewport .win-container {
    margin: 0px 10px;
}

/* hide the hover outline for edge-to-edge items */
#textAlbumTrack .win-container:hover {
    outline: none;
}

/* individual item dimensions */
.textAlbumTrack {
    display: -ms-flexbox;
    width: 280px;
    height: 36px;
    padding: 2px 10px;
    overflow: hidden;
}

    /* text line 1 col 1*/
    .textAlbumTrack .textAlbumTrackNumber {
        width: 42px;
        white-space: nowrap;
    }

    /* text line 1 col 2*/
    .textAlbumTrack .textAlbumTrackTitle {
        -ms-flex: 1;
        white-space: nowrap;
    }

Item templates for grid layouts

Item templates for list layouts