SelectionMode enumeration
TOC
Réduire la table des matières
Développer la table des matières

WinJS.UI.SelectionMode enumeration

[This documentation is preliminary and is subject to change.]

Applies to: Metro style apps only

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.

MemberValueDescription
none"none"

Items cannot be selected.

single"single"

A single item may 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 supported client

Windows 8 Consumer Preview

Minimum supported server

Windows Server 8 Beta

Namespace

WinJS.UI

Library

Ui.js

See also

ListView interaction sample
Quickstart: Adding a ListView

 

 

Build date: 2/10/2012

Ajouts de la communauté

AJOUTER
Afficher:
© 2017 Microsoft