Image and text list (inbox) 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 in an email inbox. 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="imageTextListInboxTemplate"
data-win-control="WinJS.Binding.Template">
<div class="imageTextListInbox">
<img class="imageTextListInboxImage"
data-win-bind="src: icon"/>
<div class="imageTextListInboxTextArea">
<h2 class="imageTextListInboxTextFrom"
data-win-bind="innerText: textFrom"></h2>
<h4 class="imageTextListInboxTextSubject"
data-win-bind="innerText: textSubject"></h4>
<div class="imageTextListInboxTextPreview"
data-win-bind="innerText: textPreview"></div>
</div>
<div class="imageTextListInboxTextDate"
data-win-bind="innerText: textDate"></div>
</div>
</div>
<!-- ListView -->
<div id="imageTextListInbox"
class="win-selectionstylefilled"
style="position: relative; left: -1px; top: 129px; border: none"
data-win-control="WinJS.UI.ListView"
data-win-options="{ itemDataSource: list.dataSource,
itemTemplate: select('#imageTextListInboxTemplate'),
layout: { type: WinJS.UI.ListLayout } }">
</div>
CSS
/* overall list dimensions */
#imageTextListInbox {
margin-left: 60px;
width: 501px; /* +31 px to account for margins applied by ListView */
height: 700px;
}
/*-------------------------------------------------------------------------------------------*/
/* imageTextList-inbox - used for Mail inbox item*/
/*-------------------------------------------------------------------------------------------*/
/* 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 */
.imageTextListInbox {
display: -ms-grid;
height: 75px;
padding: 5px;
-ms-grid-columns: 50px 1fr auto;
}
/* user tile */
.imageTextListInbox img.imageTextListInboxImage {
-ms-grid-column: 1;
margin: 5px;
width: 40px;
height: 40px;
}
.imageTextListInbox .imageTextListInboxTextArea {
-ms-grid-column: 2;
margin-top: -2px;
padding-left: 5px;
}
/* Text lines: From, Subject and Message preview */
.imageTextListInbox .imageTextListInboxTextArea div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Text line 2 col 2: Date received */
.imageTextListInbox .imageTextListInboxTextDate {
-ms-grid-column: 3;
margin: 10px;
line-height: 60px;
}