Using the Repeater with the ItemContainer

If you want the items displayed by a Repeater control to be invokable, selectable, or draggable then you can use the Repeater control with the ItemContainer control.

Listing 7.12 contains a simple example. The Repeater in Listing 7.12 is bound to a list of three items. The Repeater renders an ItemContainer for each of the items.

LISTING 7.12 Using a Repeater with an ItemContainer (repeaterItemContainer\repeaterItemContainer.html)

<div id="repeater1" data-win-control="WinJS.UI.Repeater">    <div data-win-control="WinJS.UI.ItemContainer" data-win-bind="dataset.name:name">        <span data-win-bind="textContent:name"></span>    </div></div>

Notice that the ItemContainer

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.