If an element is too large
for its layout container, it will be cropped to fit.
MaxWidth and MaxHeight Sets the maximum dimensions of an element. If the container has more
room available, the element won??™t be enlarged beyond these bounds,
even if the HorizontalAlignment and VerticalAlignment properties are
set to Stretch.
Width and Height Explicitly sets the size of an element. This setting overrides a Stretch
value for the HorizontalAlignment or VerticalAlignment properties.
However, this size won??™t be honored if it??™s outside of the bounds set by
the MinWidth, MinHeight, MaxWidth, and MaxHeight.
CHAPTER 4 n LAYOUT 83
All of these properties are inherited from the base FrameworkElement class and are therefore
supported by all the graphical widgets you can use in a WPF window.
nNote As you learned in Chapter 2, different layout containers can provide attached properties to their
children. For example, all the children of a Grid object gain Row and Column properties that allow them to
choose the cell where they??™re placed. Attached properties allow you to set information that??™s specific to a
particular layout container. However, the layout properties in Table 4-3 are generic enough that they apply
to many layout panels. Thus, these properties are defined as part of the base FrameworkElement class.
Pages:
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207