Udostępnij za pośrednictwem


Text tile (list 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 tile. The item contains a heading. 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.

HTML

<!-- Item template -->
<div id="textTileListFolderTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="textTileListFolder">
    <h6 data-win-bind="innerText: largeText"></h6>
  </div>
</div>

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

CSS

/* overall list dimensions */
#textTileListFolder {
    width: 1366px;
    height: 578px;
    position: absolute;
    top: -5px;
}

    /*-------------------------------------------------------------------------------------------*/
    /* textTile-listFolder - used in Picker list view                                            */
    /*-------------------------------------------------------------------------------------------*/
    /* starting margin */
    #textTileListFolder .win-horizontal.win-viewport .win-surface {
        margin: 0px 100px;
    }

    #textTileListFolder .win-horizontal.win-viewport .win-container {
        margin: 5px 20px;
    }

/* individual item dimensions */
.textTileListFolder {
    width: 270px;
    height: 60px;
    overflow: hidden;
    padding: 5px 15px;
    background-color: #333333;
    display: -ms-flexbox;
    -ms-flex-pack: end;
    -ms-flex-direction: column;
    color: rgba(255,255,255,0.8);
}

/* High Contrast */
@media (-ms-high-contrast) {
    /* add a border to the item */
    .textTileListFolder {
        padding: 3px 13px;
        color: WindowText;
        background-color: Window;
        border: 2px solid WindowText;
    }
}

Item templates for grid layouts

Item templates for list layouts