Invoking Items in a ListView Control

Under the covers, a ListView control renders ItemContainer controls for each ListView item. This is the exact same ItemContainer control that we discussed in the previous chapter. Therefore, ListView items support the same events and styling as ItemContainer controls.

You can handle the ListView control’s iteminvoked event to detect when a particular ListView item is clicked. The page in Listing 8.7 contains a standard ListView control (nothing special about it).

LISTING 8.7 Invoking a ListView Item (itemInvoked\itemInvoked.html)

<div id="tmplProduct"    data-win-control="WinJS.Binding.Template">    <div class="productItem">        <h2 data-win-bind="innerText:name"></h2>        Price: ...

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.