Template.extractChild property

Applies to Windows and Windows Phone

Gets a value that specifies whether templates should be instantiated without the creation of an additional child element. Note that not all controls use this property; see the Remarks section for more info.

Syntax


<div 
    data-win-control="WinJS.Binding.Template" 
    data-win-options="{ extractChild : value}" >
</div>


var extractChild = template.extractChild;
template.extractChild = extractChild;

Property value

Type: Boolean

true if the template uses its first child as the container element; false if the template generates an additional container element. The default value is false.

Remarks

By default, templates create a new container div, then add their child elements into the new div. This new div adds a new (often unnecessary) element into the rendered control tree. Setting extractChild to true allows the developer to specify that the first child element of the template control should be the container for the template.

Which controls use the extractChild property?

Not all controls use the extractChild property. Here's a list of how different controls use or don't use it.

ControlProcesses extractChild?
FlipView Yes. The extractChild property works as expected.
ListView Yes. The extractChild property works as expected.
NavBarContainer No. The NavBarContainer control always behaves as though extractChild is true, regardless of its actual value.
Repeater No. The Repeater control always behaves as though extractChild is true, regardless of its actual value.

 

Requirements

Minimum supported client

Windows 8.1 [Windows Store apps only]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

Namespace

WinJS.Binding

Library

Base.js

See also

Template

 

 

Show:
© 2014 Microsoft