Content Controls

Sometimes, you want to create a control that can contain some custom content. The Button control is a good example, enabling you to customize what is displayed within the button, such as an image, text, and so on. The Button control can contain only a single control as its content, but other content controls, such as the Grid control, can contain multiple controls as their content. Let's take a look at how you can create a custom content control that can contain either a single control as its content or multiple controls.

Containing a Single Control as Content

The Button control is a content control, and you can make your own control a content control by inheriting from ContentControl instead of Control. This will expose a

Get Pro Business Applications with Silverlight 5 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.