Prev | Current Page 268 | Next

Matthew MacDonald

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


Figure 5-12. A basic border
Chapter 7 has more details about brushes and the colors you can use to set BorderBrush
and Background.
nNote Content controls already have border properties. For example, the Expander controls shown in
Figure 5-10 and Figure 5-11 use them to draw a nice outline around the expandable region. (The only
exception is the Button control, which doesn??™t use its border properties because it relies on the
ButtonChrome decorator instead.) The Border element is intended to add a border around elements that
don??™t have this functionality??”namely the layout containers you explored in Chapter 4.
TheViewbox
The Viewbox is a more exotic decorator. Its full use won??™t become apparent until you learn
more about custom drawing in Chapter 13. However, the basic principle behind the Viewbox
is easy enough to grasp. Basically, any content you place inside the Viewbox is scaled up or
down to fit the bounds of the Viewbox.
The Viewbox scaling process is much more dramatic than the stretch alignment settings
you learned about in Chapter 4. When you stretch an element, you simply change the space
that??™s available to that element. This change doesn??™t have an effect on most vector content
because vector drawings usually use fixed coordinates.
For example, consider the button-with-a-shape example that you saw earlier.


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