Gets or sets the selection mode of the ListView.
Syntax
<div data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode : 'value'}" ></div>
var selectionMode = listView.selectionMode;
listView.selectionMode = selectionMode;
Property value
Type: SelectionMode
One of the values defined by the SelectionMode enumeration. The default value is multi. Do not the TapBehavior property to "directSelect" when the 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 supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
WinJS.UI |
|
Library |
|
See also
Build date: 12/5/2012