Share via


Image and text (list file) 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 represents a file: an icon, the name, a date, and its size. 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="imageTextListFileTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="imageTextListFile">
    <img class="imageTextListFileImage" data-win-bind="src: icon"/>
    <div class="imageTextListFileTextArea">
      <h3 class="imageTextListFileTextName" 
          data-win-bind="innerText: textName">        
      </h3>
      <h6 class="imageTextListFileTextDate" 
          data-win-bind="innerText: textDate">
      </h6>
      <h6 class="imageTextListFileTextSize" 
          data-win-bind="innerText: textSize">        
      </h6>
    </div>
  </div>
</div>

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

CSS

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

/*-------------------------------------------------------------------------------------------*/
/* imageText-listFile - used in Picker list */
/*-------------------------------------------------------------------------------------------*/

/* 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 */
#imageTextListFile .win-horizontal.win-viewport .win-surface {
    margin: 0px 100px;
}

#imageTextListFile .win-horizontal.win-viewport .win-container {
    margin: 5px 10px;
}

/*individual item dimensions */
.imageTextListFile {
    display: -ms-grid;
    width: 290px;
    height: 60px;
    overflow: hidden;
    padding: 5px;
}

    /* image */
    .imageTextListFile img.imageTextListFileImage {
        -ms-grid-column: 1;
        margin: 5px;
        width: 40px;
        height: 40px;
    }

    .imageTextListFile .imageTextListFileTextArea {
        -ms-grid-column: 2;
        margin: 0px 5px 0px 5px;
    }

        /* text line 1 */
        .imageTextListFile .imageTextListFileTextArea .imageTextListFileTextName {
            width: 230px;
            white-space: nowrap;
        }

        /* text line 2 */
        .imageTextListFile .imageTextListFileTextArea .imageTextListFileTextDate {
            width: 230px;
            overflow: hidden;
        }

        /* text line 3 */
        .imageTextListFile .imageTextListFileTextArea .imageTextListFileTextSize {
            width: 230px;
            overflow: hidden;
        }

Item templates for grid layouts

Item templates for list layouts