EditCategory
Data Binding
EditQuestion
What is the difference between a "{Binding ...}" and a "{TemplateBinding ... }"?
EditAnswer
Binding is the most typical and versatile option of the two. TemplateBinding provides much fewer options than Binding and is applicable only in the context of a Template (such as DataTemplates and ControlTemplates).
In fact, one can say that TemplateBinding is the equivalent of a Binding on which the RelativeSource property has been set to RelativeSource.TemplatedParent.
Example:
<Control property="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>While TemplateBinding has a much more friendly syntax than Binding, using TemplateBinding has limitations.
One such limitation is that while using TemplateBinding, it is not possible to change the Mode and the UpdateSourceTrigger of the underlying binding (using the target property's default value for Mode and UpdateSourceTrigger).
EditKeywords
binding, templatebinding, updatesourcetrigger, mode