<c:invoke-delegate
delegate = expression(XcstDelegate<TItem>)
with-params? = expression(Object | IDictionary<String, Object>)
tunnel-params? = expression(Object | IDictionary<String, Object>) >
<!-- Content: c:with-param* -->
</c:invoke-delegate>
Invokes a template delegate.
- Category
- instruction
- Permitted parent elements
- Any XCST element whose content model is sequence-constructor
- Any literal result element
Attributes
delegate |
The template delegate instance. |
tunnel-params |
An object with tunnel parameters. |
with-params |
An object with parameters. |
In addition to the attributes in the preceding table, there are a number of standard attributes that may appear on any XCST element.
Example: Creating and Using a Delegate
<c:variable name='pagerItem'>
<c:delegate>
<c:param name='page' as='int' required='yes'/>
<c:param name='text' as='string'/>
<c:param name='@class' as='string'/>
<li>
...
</li>
</c:delegate>
</c:variable>
<ul class='pagination'>
<c:invoke-delegate delegate='pagerItem' with-params='new { page = currentPage - 1, text = "← Previous", @class = "page-prev" }'/>
<c:invoke-delegate delegate='pagerItem' with-params='new { page = 1 }'/>
...
</ul>
Example: Delegate Parameter
<c:import-namespace ns='Xcst'/>
<c:template name='pagination'>
<c:param name='currentPage' as='int'/>
<c:param name='pagerItem' as='XcstDelegate<object>'/>
<ul class='pagination'>
<c:invoke-delegate delegate='pagerItem' with-params='new { page = currentPage - 1, text = "← Previous", @class = "page-prev" }'/>
<c:invoke-delegate delegate='pagerItem' with-params='new { page = 1 }'/>
...
</ul>
</c:template>