O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

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

Creating a custom (templated) control

User controls are great for encapsulating a piece of UI functionality that can be easily reused. Their potential disadvantage is the lack of deep customization. In case such customization is required (or at least anticipated), a custom control should be built. This is a class deriving from Control, that provides a default look (through a control template), but that template can be changed if needed, without harming the control's functionality. In fact, this is how all WPF controls work - they provide some default template (look), but we can replace that template while preserving the control's behavior, as we've seen in Chapter 8,Styles, Triggers, and Control Templates.

In this recipe, we'll take a look at ...

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