Content Controls

As you learned in Chapter 5, many of the most fundamental WPF controls are actually content controls. These include the well-worn Label, Button, CheckBox, and RadioButton.

Labels

The simplest of all content controls is the Label control. Like any other content control, it accepts any single piece of content you want to place inside. But what distinguishes the Label control is its support for mnemonics—essentially, shortcut keys that set the focus to a linked control.

To support this functionality, the Label control adds a single property, named Target. To set the Target property, you need to use a binding expression that points to another control. Here's the syntax you must use:

<Label Target="{Binding ElementName=txtA}">Choose ...

Get Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.