Partilhar via


WinJS.UI.ItemContainer object

Defines an item that can be pressed, swiped, and dragged.

Syntax

<div 
    data-win-control="WinJS.UI.ItemContainer">
</div>
var object = new WinJS.UI.ItemContainer();

Members

The ItemContainer object has these types of members:

  • Constructors
  • Events
  • Methods
  • Properties

Constructors

The ItemContainer object has these constructors.

Constructor Description
ItemContainer

Creates a new ItemContainer.

 

Events

The ItemContainer object has these events.

Event Description
oninvoked

Raised when the item is invoked. (You can use the tapBehavior property to specify whether taps and clicks invoke the item.)

onselectionchanged

Raised after the item is selected or deselected.

onselectionchanging

Raised just before the current selection changes.

 

Methods

The ItemContainer object has these methods.

Method Description
addEventListener

Registers an event handler for the specified event.

dispatchEvent

Raises an event of the specified type and with additional properties.

dispose

Releases resources held by this ItemContainer. Call this method when the ItemContainer is no longer needed. After calling this method, the ItemContainer becomes unusable.

forceLayout

Forces the ItemContainer to update its layout. Call this function when the reading direction of the app changes after the control has been initialized.

removeEventListener

Removes an event handler that the addEventListener method registered.

 

Properties

The ItemContainer object has these properties.

Property Access type Description

draggable

Read/write

Gets or sets a value that specifies whether the item can be dragged.

element

Read-only

Gets the element that hosts this ItemContainer.

selected

Read/write

Gets or sets a value that specifies whether the item is selected.

selectionDisabled

Read/write

Gets or sets a value that specifies whether selection of this item is disabled.

swipeBehavior

Read/write

Gets or sets how the ItemContainer reacts to the swipe gesture. The swipe gesture can select the swiped items or can have no effect on the current selection.

swipeOrientation

Read/write

Gets or sets the orientation of swipe gestures.

tapBehavior

Read/write

Gets or sets how the ItemContainer reacts when the user taps or clicks an item.

 

Remarks

For the ItemContainer to be accessible, its host div element must have its role attribute set to "list" or "listbox". If tapBehavior is set to none and selectionDisabled is true, then use the "list" role; otherwise, use the "listbox" role. The aria-multiselectable attribute of the parent <div> must be set to 'true' as well.

Requirements

Minimum WinJS version

WinJS 3.0

Namespace

WinJS.UI