Specifies a visual that contains templates that can override the default Templates provided in this object.

If specified together with TemplateKey, this instantiator will prefer to pick template from the specified TemplateSource that matches the TemplateKey property. If no match is found, it falls back to using the regular list of Templates. Refer to Defaults.

This property is useful if you are creating a component and want to allow certain templates inside the component to be overridden by the user.


This example uses Each, but it applies equally to Instance and other subclasses of Instantiator.

<Panel ux:Class="MyListControl">
        <Each Count="10" TemplateSource="this" TemplateKey="ListItem">
            <Text Value="This is an item" />

If we instantiate <MyListControl> now, it will display the text "This is an item" 10 times.

However, we can override the template like this:

    <Rectangle ux:Template="ListItem" Color="Red">
        <Text>This is a red item</Text>

This will display a red rectangle with the text "This is a red item" 10 times, instead of the default template defined in the component itself.

The TemplateSource property, along with the templates in the source, as well as the TemplateKey, must be set prior to rooting to take effect.


Fuse.Reactive.Bindings 1.9.0