Prev | Current Page 254 | Next

Matthew MacDonald

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

Not only is the nested content
model more flexible, it also allows the Button class to expose a simpler interface. And because
all content controls support content nesting in the same way, there??™s no need to add different
content properties to multiple classes. (Windows Forms ran into this issue in .NET 2.0, while
enhancing the Button and Label class to better support images and mixed image-and-text
content.)
In essence, the nested content model is a trade. It simplifies the class model for elements
because there??™s no need to use additional layers of inheritance to add properties for different
types of content. However, you need to use a slightly more complex object model??”elements
that can be built out of other nested elements.
nNote You can??™t always get the effect you want by changing the content of a control. For example, even
though you can place any content in a button, a few details never change, such as the button??™s shaded background,
its rounded border, and the mouse-over effect that makes it glow when you move the mouse pointer
over it. However, there??™s another way to change these built-in details??”by applying a new control template.
Chapter 15 shows how you can change all aspects of a control??™s look and feel using a control template.
Specialized Containers
In Chapter 7, you??™ll consider all the control basics and look at simple content controls such as
the Label and Button in more detail.


Pages:
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266