Table of Contents

Class TemplateBindingExtension

Namespace
Icy.Markup.Extensions
Assembly
IcyUI.dll

{TemplateBinding Path}: inside a ControlTemplate's content, binds a property to a path evaluated against the control the template is being applied to.

[MarkupExtensionDefaultProperty("Path")]
public sealed class TemplateBindingExtension : IMarkupExtension
Inheritance
TemplateBindingExtension
Implements
Inherited Members
Extension Methods

Remarks

This is how a template's own elements reach the control they decorate - Style/ VisualState setters still only ever target the control's own top-level properties (e.g. Background), exactly as without a template; a {TemplateBinding Background} on some element inside the template then reflects whatever value that property currently has.

Deliberately narrower than {Binding}: always one-way, from the templated control, refreshed automatically whenever the control raises PropertyChanged (the default Reactive behavior every Binding already has) - no ElementName/Source/Mode/UpdateTargetTrigger surface, since none of those make sense for the control this template belongs to.

Properties

Path

Gets or sets the path, relative to the templated control, to bind to.

public string? Path { get; set; }

Property Value

string

Methods

ProvideValue(MarkupExtensionContext)

Computes the value the loader should use.

public object? ProvideValue(MarkupExtensionContext context)

Parameters

context MarkupExtensionContext

The property being resolved, and what the loader knows about the document.

Returns

object

The value to assign, converted the same way an ordinary attribute value would be; or Unset when the extension already applied its own effect (typically by binding the property itself) and nothing further should be assigned.

Exceptions

MarkupException

This extension was used outside a ControlTemplate's content, the target doesn't support bindings, the property isn't a registered one, or Path is unset.