Prev | Current Page 267 | Next

Matthew MacDonald

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


There are also two more general decorators that are useful when composing user interfaces:
the Border and the Viewbox.
The Border
The Border class is pure simplicity. It takes a single piece of nested content (which is often a
layout panel) and adds a background or border around it.
To master the Border, you need nothing more than the properties listed in Table 5-1.
Table 5-1. Properties of the Border Class
Name Description
Background Sets a background that appears behind all the content in the
border using a Brush object. You can use a solid color or
something more exotic.
BorderBrush and BorderThickness Set the color of the border that appears at the edge of the
Border object, using a Brush object, and set the width of the
border, respectively. To show a border, you must set both
properties.
CornerRadius Allows you to gracefully round the corners of your border.
The greater the CornerRadius, the more dramatic the rounding
effect is.
Padding Adds spacing between the border and the content inside.
(By contrast, margin adds spacing outside the border.)
Here??™s a straightforward, slightly rounded border around a group of buttons in a
StackPanel:
BorderBrush="SteelBlue" BorderThickness="3,5,3,5" CornerRadius="3"
VerticalAlignment="Top">


CHAPTER 5 n CONTENT 135




Figure 5-12 shows the result.


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