Prev | Current Page 247 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"


119
C H A P T E R 5
120 CHAPTER 5 n CONTENT
nTip Of course, you can still pack in a lot of content in a single content control??”the trick is to wrap everything
in a single container, such as a StackPanel or a Grid. For example, the Window class is itself a content
control. Obviously, windows often hold a great deal of content, but it??™s all wrapped in one top-level container.
(Typically, this container is a Grid.)
As you learned last chapter, all WPF layout containers derive from the abstract Panel class,
which gives the support for holding multiple elements. Similarly, all content controls derive
from the abstract ContentControl class. Figure 5-1 shows the class hierarchy.
Figure 5-1. The hierarchy of content controls
As Figure 5-1 shows, several common controls are actually content controls, including the
Label and the ToolTip. Additionally, all types of buttons are content controls, including the
familiar Button, the RadioButton, and the CheckBox. There are also a few more specialized
content controls, such as ScrollViewer (which allows you to create a scrollable panel), and
UserControl class (which allows you to reuse a custom grouping of controls). The Window
class, which is used to represent each window in your application, is itself a content control.
Finally, there is a subset of content controls that goes through one more level of inheritance
by deriving from the HeaderedContentControl class.


Pages:
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259