In the arrange stage, the container places the child elements in the appropriate position.
Of course, an element can??™t always get its preferred size??”sometimes the container isn??™t
large enough to accommodate it. In this case, the container must truncate the offending
element to fit the visible area. As you??™ll see, you can often avoid this situation by setting a
minimum window size.
nNote Layout containers don??™t provide any scrolling support. Instead, scrolling is provided by a
specialized content control??”the ScrollViewer??”that can be used just about anywhere. You??™ll learn about
the ScrollViewer in Chapter 5.
The Layout Containers
All the WPF layout containers are panels that derive from the abstract System.Windows.Controls.
Panel class (see Figure 4-1). The Panel class adds a small set of members, including the
three public properties that are detailed in Table 4-1.
Figure 4-1. The hierarchy of the Panel class
Table 4-1. Public Properties of the Panel Class
Name Description
Background The brush that??™s used to paint the panel background. You must set this property
to a non-null value if you want to receive mouse events. (If you want to receive
mouse events but you don??™t want to display a solid background, just set the
background color to Transparent.) You??™ll learn more about basic brushes in
Chapter 7 (and more advanced brushes in Chapter 13).
Pages:
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200