Udostępnij za pośrednictwem


Text list (mail folder) 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 mail folder in a list of mail folders. 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="textListMailFolderTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="textListMailFolder">
    <h2 data-win-bind="innerText: text"></h2>
  </div>
</div>

<!-- ListView -->
<div id="textListMailFolder"
    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('#textListMailFolderTemplate'), 
    layout: { type: WinJS.UI.ListLayout } }">
</div>

CSS

/* overall list dimensions */
#textListMailFolder {
    margin-left: 110px;
    width: 308px; /*+18 px to account for scrollbar*/
    height: 632px;
}

/*-------------------------------------------------------------------------------------------*/
/* textList-mailFolder - used for Mail folder*/
/*-------------------------------------------------------------------------------------------*/

/* 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 */
.textListMailFolder {
    width: 100%;
    height: 40px;
    padding: 4px 10px;
    overflow: hidden;
}

Item templates for grid layouts

Item templates for list layouts