Understanding the ContentControl

One of the biggest presentation benefits in WPF is the capability for controls to show more than simple text. Particularly, all controls exposing a Content property can nest complex visual elements to offer special effects with or without text. For example, consider the following button whose content is just text:

<Button Name="Button1" Width="100" Height="100" Content="Click me!"/>

The Content property can be declared in a hierarchical fashion so that you can take advantage of the XAML logic for nesting complex elements. The following example shows how you can replace the button text with a movie:

<Button Name="Button1" Width="100" Height="100">    <Button.Content> ...

Get Visual Basic 2015 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.