Share via


Image and text list (collection) 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 an icon, a larger, bold heading, a smaller subheading, and descriptive text. This template is for use with a ListView that has a list 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="imageTextListCollectionTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="imageTextListCollection">
    <img class="imageTextListCollectionImage" 
         data-win-bind="src: icon"/>
    <div class="imageTextListCollectionTextArea">
      <h4 class="imageTextListCollectionTextStrong" 
          data-win-bind="innerText: largeText"></h4>
      <h6 class="imageTextListCollectionTextLight" 
          data-win-bind="innerText: smallText"></h6>
      <div class="imageTextListCollectionText" 
           data-win-bind="innerText: mediumText"></div>
    </div>
  </div>
</div>

<!-- ListView -->
<div id="imageTextListCollection"
    class="win-selectionstylefilled"
    data-win-control="WinJS.UI.ListView"
    data-win-options="{ itemDataSource: list.dataSource, 
        itemTemplate: select('#imageTextListCollectionTemplate'), 
        layout: { type: WinJS.UI.ListLayout } }">
</div>

CSS

/* overall list dimensions */
#imageTextListCollection {
    margin: 0px 110px;
    width: 531px; /* +31 px to account for margins applied by ListView */
    height: 637px;
}

/*-------------------------------------------------------------------------------------------*/
/* imageTestList-collection - used in app template collection page in portrait*/
/*-------------------------------------------------------------------------------------------*/

/* 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 */
#imageTextListCollection .imageTextListCollection {
    display: -ms-grid;
    width: 100%;
    height: 120px;
    padding: 5px;
    overflow: hidden;
}

/* image */
.imageTextListCollection img.imageTextListCollectionImage {
    -ms-grid-column: 1;
    width: 110px;
    height: 110px;
    margin: 5px;
}

.imageTextListCollection .imageTextListCollectionTextArea {
    -ms-grid-column: 2;
    margin: 9px 5px 5px 5px;
    line-height: 20px;
}

/* text line 1 */
.imageTextListCollection .imageTextListCollectionTextStrong {
    width: 360px;
    height: 20px;
    overflow: hidden;
}

/* text line 2 */
.imageTextListCollection .imageTextListCollectionTextLight {
    width: 360px;
    height: 20px;
    overflow: hidden;
}

/* text line 3 */
.imageTextListCollection .imageTextListCollectionText {
    width: 360px;
    height: 60px;
    overflow: hidden;
}

Item templates for grid layouts

Item templates for list layouts