Prev | Current Page 266 | Next

Matthew MacDonald

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

..



It would be nice to have a system in which an Expander could set the size of its content
region based on the available space in a window. However, this would present obvious complexities.
(For example, how would space be shared between multiple regions when an
CHAPTER 5 n CONTENT 134
Expander expands?) The Grid layout container might seem like a potential solution, but unfortunately
it doesn??™t integrate well with the Expander. If you try it out you??™ll end up with oddly
spaced rows that don??™t update their heights properly when an Expander is collapsed.
Decorators
You??™ve now seen several containers that are designed to help you manage other bits of content,
including the ScrollViewer, GroupBox, and Expander. That makes this a good point to
pause and consider another branch of container-like elements that aren??™t content controls.
These are decorators, and they??™re typically used to add some sort of graphical embellishment
around an object.
All decorators derive from System.Windows.Controls.Decorator. Most decorators are
designed for use with specific controls. For example, the Button uses a ButtonChrome decorator
to get its trademark rounded corner and shaded background, while the ListBox uses the
ListBoxChrome decorator. Changing the appearance of these controls involves replacing their
decorator with something else, as you??™ll see in Chapter 15.


Pages:
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278