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

Using content controls

Content controls provide a flexible way of customizing the appearance of a control. The ContentControl class includes a Content property, of type object; meaning, it can be anything. A typical example is a Button. The Button inherits from ContentControl (not directly, but this is unimportant for this discussion). A typical button shows text, an image, or perhaps an image and text. But in fact, it can hold anything, such as a graphic drawing, a video playing, any combination of the above, or anything else. This is the power of ContentControl. Let's see how this works.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create several buttons (which are ContentControls) and show the various ways their ...

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