Selecting an ItemContainer

Selecting an ItemContainer raises both a selectionchanging and selectionchanged event. You can handle these events to detect when an ItemContainer is selected.

Imagine, for example, that you want to create a set of options that work like radio buttons. When you select one option, all of the other options are unselected automatically so that you can select only one option at a time.

Listing 7.3 contains three ItemContainers that represent the three options.

LISTING 7.3 Selecting an ItemContainer (ItemContainerSelection\ItemContainerSelection.html)

<div class="option" data-win-control="WinJS.UI.ItemContainer">    Option 1</div><div class="option" data-win-control="WinJS.UI.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.