This content
model is one of the details that make WPF so remarkably flexible.
In this chapter, you??™ll explore the base ContentControl class that supports this model.
You??™ll also learn how to use more specialized ContentControl descendants to make your
panels scrollable and collapsible.
Understanding Content Controls
In Chapter 1, you took a look at the class hierarchy that??™s at the core of WPF. You also considered
the difference between elements (which include everything you??™ll place in a WPF
window) and controls (which are more specialized elements that derive from the System.Windows.
Controls.Control class).
In the world of WPF, a control is generally described as an element that can receive focus
and accept user input, such as a text box or a button. However, the distinction is sometimes
a bit blurry. The ToolTip is considered to be a control because it appears and disappears
depending on the user??™s mouse movements. The Label is considered to be a control because
of its support for mnemonics (shortcut keys that transfer the focus to related controls).
Content controls are a still more specialized type of controls that are able to hold (and
display) a piece of content. Technically, a content control is a control that can contain a single
nested element. The one-child limit is what differentiates content controls from layout containers,
which can hold as many nested elements as you want.
Pages:
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258