Language: HTML | XAML

Image and text (collection) template (HTML)

Applies to Windows only

Defines an item that contains an image, a large heading, a subheading, and body text. 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="imageTextCollectionTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="imageTextCollection">
    <img class="imageTextCollectionImage" 
         data-win-bind="src: icon" />
    <div class="imageTextCollectionDetail">
      <h3 class="imageTextCollectionTextStrong" 
          data-win-bind="innerText: largeText">
      </h3>
      <h6 class="imageTextCollectionTextLight" 
          data-win-bind="innerText: smallText">
      </h6>
      <div class="imageTextCollectionText" 
           data-win-bind="innerText: mediumText">
      </div>
    </div>
  </div>
</div>

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

CSS


/* overall list dimensions */
#imageTextCollection {
    width: 1366px;
    height: 578px;
}

/*-------------------------------------------------------------------------------------------*/
/* imageText-collection - used app template collection page */
/*-------------------------------------------------------------------------------------------*/

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

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

/* margin between items */
#imageTextCollection .win-horizontal.win-viewport .win-container {
    margin: 5px 30px;
}

/* individual item dimensions */
.imageTextCollection {
    width: 490px;
    height: 120px;
    padding: 5px;
    overflow: hidden;
    display: -ms-grid;
}

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

    .imageTextCollection .imageTextCollectionDetail {
        margin: 9px 5px 5px 5px;
        -ms-grid-column: 2;
    }

        /* text line 1 */
        .imageTextCollection .imageTextCollectionDetail .imageTextCollectionTextStrong {
            width: 360px;
            height: 20px;
            white-space: nowrap;
        }

        /* text line 2 */
        .imageTextCollection .imageTextCollectionDetail .imageTextCollectionTextLight {
            width: 360px;
            height: 20px;
            overflow: hidden;
        }

        /* text line 3 */
        .imageTextCollection .imageTextCollectionDetail .imageTextCollectionText {
            width: 360px;
            height: 60px;
            overflow: hidden;
        }



Related topics

Item templates for grid layouts
Item templates for list layouts

 

 

Show:
© 2015 Microsoft