Templates
Controls have many properties you can use to customize their look: Button has configurable Background and Foreground Brushes (which can even be fancy gradients or bitmap-based content), Slider’s ticks can be relocated by setting the TickPlacement property, and so on. But you can do only so much with such properties.
A template, on the other hand, allows you to completely replace an element’s visual tree with anything you can dream up, while keeping all of its functionality intact. And templates aren’t just some add-on mechanism for third parties; the default visuals for every Control are defined in templates. The source code for every control is completely separated from its default visual tree representations (or “visual source code”). ...
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