O'Reilly logo

Fluent C# by Rebecca M. Riordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

21. Templates

In the last chapter we saw how you can use resources, styles and triggers to simplify defining the appearance and visual behavior of a WPF control, but the basic structure of the elements remained the same—we changed the size and color of a button, and made it move around, but it still looked like a button. In this chapter, we’ll take control of that structure as well by using WPF templates to re-define the visual tree of any FrameworkElement or FrameworkContentElement.

Want your buttons to be triangular? No problem. Does your application really require an oval window? You can make that happen using templates.

We’ll start by examining some fundamental elements you can use to build your new versions of controls, and then we’ll look ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required