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 (and customized for light versus dark versus high contrast themes). The source code for every control is completely separated ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.