次の方法で共有


WinJS.Binding.Template object

Provides a reusable declarative binding element.

Syntax

var object = new WinJS.Binding.Template(element, options);

Members

The Template object has these types of members:

  • Constructors
  • Methods
  • Properties

Constructors

The Template object has these constructors.

Constructor Description
Template

Creates a template that provides a reusable declarative binding element.

 

Methods

The Template object has these methods.

Method Description
render

Binds values from the specified data context to elements that are descendants of the specified root element that have the declarative binding attributes specified (data-win-bind).

render

Renders a template based on the specified URI (static method).

renderItem

Renders an instance of this template bound to the data contained in item. If the recycled parameter is present, and enableRecycling is true, then the template attempts to reuse the DOM elements from the recycled parameter.

 

Properties

The Template object has these properties.

Property Access type Description

bindingInitializer

Read/write

Gets or sets the default binding initializer for the template.

debugBreakOnRender

Read/write

Gets or sets a value that specifies whether a debug break is inserted into the first rendering of each template. This property only has an effect when the app is in debug mode.

disableOptimizedProcessing

Read/write

This property is deprecated and might not be available in future versions of the WinJS. Gets or sets a value that specifies whether optimized template processing has been disabled.

element

Read/write

Gets the DOM element that is used as the template.

extractChild

Read/write

Gets a value that specifies whether templates should be instantiated without the creation of an additional child element.

isDeclarativeControlContainer

Read-only

Determines whether the Template contains declarative controls that must be processed separately. This property is always true. The controls that belong to a Template object's children are instantiated when a Template instance is rendered.

 

Remarks

For more information about using templates with a ListView, see Quickstart: Add a ListView. You can also refer to the HTML ListView essentials sample (Windows). For more information about using templates with a FlipView, see Adding FlipView controls. You can also refer to the HTML FlipView control sample (Windows). For an explanation of how to use these templates with an array, see How to use templates to bind data.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Binding