Selecting Items in a ListView Control

You can use the ListView control’s selectionchanging and selectionchanged events to detect when an item is selected in a ListView. Imagine, for example, that you want to create a master/detail page: You want to display a list of product categories and, when a user selects a product category, display a list of matching products (see Figure 8.10).

Image

FIGURE 8.10 Selecting ListView items

The page in Listing 8.9 contains two ListView controls: a ListView that displays the categories and a ListView that displays the matching products.

LISTING 8.9 Creating a Master/Detail Page (masterDetail\masterDetail.html)

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.