Text tile (landing) template
Language: HTML | XAML

Text tile (landing) 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 section with larger, bold text and a section with smaller 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.

HTML


<!-- Item template -->
<div id="textTileLandingTemplate" 
     data-win-control="WinJS.Binding.Template">
  <div class="textTileLanding">
    <h2 class="textTileLandingTextStrong" 
        data-win-bind="innerText: largeText"> 
    </h2>
    <h6 class="textTileLandingTextLight" 
        data-win-bind="innerText: smallText">
    </h6>
  </div>
</div>

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

CSS


/* overall list dimensions */
#textTileLanding {
    width: 1366px;
    height: 538px;
}
    /*-------------------------------------------------------------------------------------------*/
    /* textTile-landing - used in app template landing page                                      */
    /*-------------------------------------------------------------------------------------------*/
    /* starting margin */
    #textTileLanding .win-horizontal.win-viewport .win-surface {
        margin: 0px 115px;
    }

/* individual item dimensions */
.textTileLanding {
    display: -ms-flexbox;
    -ms-flex-pack: end;
    -ms-flex-direction: column;
    width: 220px;
    height: 220px;
    padding: 15px;
    overflow: hidden;
    background-color: rgba(128,128,128,1.0);
}

    /* text line 1 */
    .textTileLanding .textTileLandingTextStrong {
        display: -ms-flexbox;
        -ms-flex-pack: end;
        -ms-flex-direction: column;
        overflow: hidden;
        line-height: 24pt;
        color: rgba(255,255,255,0.8);
    }

    /* text line 2 */
    .textTileLanding .textTileLandingTextLight {
        height: 15px;
        white-space: nowrap;
        color: rgba(255,255,255,0.49);
    }

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

        /* text line 1: use high contrast colors */
        .textTileLanding .textTileLandingTextStrong {
            color: WindowText;
        }

        /* text line 2: use high contrast colors */
        .textTileLanding .textTileLandingTextLight {
            color: WindowText;
        }
}


Related topics

Item templates for grid layouts
Item templates for list layouts

 

 

Show:
© 2018 Microsoft