Share via


WinJS.Binding Namespace

Provides functionality for data and template binding.

For more information about binding, see the topics Quickstart: binding data and styles to HTML elements and How to bind a complex object.

The WinJS.Binding namespace has these types of members:

  • Objects
  • Properties
  • Functions

Objects

Object Description

dynamicObservableMixin object

Allows you to add bindable properties dynamically.

FilteredListProjection object

Do not instantiate. A list returned by the createFiltered method.

GroupsListProjection object

A list of groups.

GroupedSortedListProjection object

Do not instantiate. Sorts the underlying list by group key and within a group respects the position of the item in the underlying list. Returned by createGrouped.

List object

Represents a list of objects that can be accessed by index or by a string key. Provides methods to search, sort, filter, and manipulate the data.

mixin object

Provides a standard implementation of the bindable contract, as well as a basic storage mechanism that participates in change notification and an asynchronous notification implementation.

observableMixin object

Provides functions that can make an object observable.

SortedListProjection object

Do not instantiate. Returned by the createSorted method.

Template object

Provides a reusable declarative binding element.

 

Properties

Property Description

optimizeBindingReferences property

Determines whether or not binding should automatically set the ID of an element. This property should be set to true in apps that use WinJS (WinJS) binding.

 

Functions

Function Description

addClassOneTime method

Adds a CSS class from the specified path of the source object to a destination object.

as function

Returns an observable object. This may be an observable proxy for the specified object, an existing proxy, or the specified object itself if it directly supports observation.

bind function

Links the specified binding descriptor to the specified observable source object.

converter function

Creates a default binding initializer for binding between a source property and a destination property with the specified converter function that is executed on the value of the source property.

defaultBind function

Creates a one-way binding between the source object and the destination object.

Warning  Do not attempt to bind data to the ID of an HTML element.
 

define function

Creates a new constructor function that supports observability with the specified set of properties.

expandProperties function

Wraps the specified object so that all its properties are instrumented for binding. This is meant to be used in conjunction with the binding mixin.

initializer function

Marks a custom initializer function as being compatible with declarative data binding.

notify function

Notifies listeners that a property value was updated.

oneTime function

Sets the destination property to the value of the source property.

processAll function

Binds the values of an object to the values of a DOM element that has the data-win-bind attribute. If multiple DOM elements are to be bound, you must set the attribute on all of them. See the example below for details.

setAttribute function

Creates a one-way binding between the source object and an attribute on the destination element.

setAttributeOneTime function

Sets an attribute on the destination element to the value of the source property.

unwrap function

Returns the original (non-observable) object is returned if the specified object is an observable proxy,

 

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Binding

See also

Declarative binding sample

Programmatic binding sample