Compartir a través de


WinJS.UI.SelectionMode enumeration

Specifies the selection mode of a ListView.

Syntax

var WinJS.UI.SelectionMode = {
  none : "none", 
  single : "single", 
  multi : "multi"
}

Members

The SelectionMode enumeration has these members.

Member Value Description
none "none"

Items can't be selected.

single "single"

A single item can be selected.

multi "multi"

Multiple items may be selected. Clicking additional items adds them to the selection.

Remarks

Do not set a ListView control's TapBehavior property to "directSelect" when its SelectionMode is set to "none".

Examples

The following example sets the selection mode so that only a single item can be selected.

<div id="basicListView" 
    data-win-control="WinJS.UI.ListView"
    data-win-options="{ itemDataSource : DataExample.itemList.dataSource, itemTemplate: mediumListIconTextTemplate, selectionMode: 'single'}">
</div> 

(For the complete code that creates the ListView in this example, see the Quickstart: Adding a ListView topic.)

The next example shows how to set the selectionMode of the ListView in JavaScript.

var myListView = document.getElementById("basicListView1").winControl;
myListView.selectionMode = WinJS.UI.SelectionMode.single;

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI

See also

Quickstart: Adding a ListView