Setting Template Inside a Style
It’s worth emphasizing why setting the Template property inside a Style is so powerful. It has two important advantages:
→ It gives you the effect of default templates when combined with an implicit Style, as leveraged in Listing 17.1. Independent of this, there is no such thing as a default control template.
→ It enables you to provide default yet overridable property values that control the look of the template. In other words, it enables you to respect the templated parent’s properties but still provide your own default values.
The final point is important. When Listing 17.1 changed the custom template’s top gradient color from a hard-coded Blue to pick up the Button’s Background.Color, the default value became ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access