Prev | Current Page 194 | Next

Matthew MacDonald

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

Depending on the current size of the
window, this may result in some elements that don??™t fit, as shown in Figure 4-3.
CHAPTER 4 n LAYOUT 82
Figure 4-3. The StackPanel with horizontal orientation
Clearly, this doesn??™t provide the flexibility real applications need. Fortunately, you can
fine-tune the way the StackPanel and other layout containers work using layout properties,
as described next.
Layout Properties
Although layout is determined by the container, the child elements can still get their say. In
fact, layout panels work in concert with their children by respecting a small set of layout
properties, as listed in Table 4-3.
Table 4-3. Layout Properties
Name Description
HorizontalAlignment Determines how a child is positioned inside a layout container when
there??™s extra horizontal space available. You can choose Center, Left,
Right, or Stretch.
VerticalAlignment Determines how a child is positioned inside a layout container when
there??™s extra vertical space available. You can choose Center, Top,
Bottom, or Stretch.
Margin Adds a bit of breathing room around an element. The Margin property
is an instance of the System.Windows.Thickness structure, with
separate components for the top, bottom, left, and right edges.
MinWidth and MinHeight Sets the minimum dimensions of an element.


Pages:
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206