All of the WPF control classes inherit from the
Control class, and that common ancestry gives them many properties in common. For example, most of them have properties that determine their size and position, foreground and background colors, transformations, and font properties.
This chapter describes some of the properties that many controls share. Later chapters mention some of these properties again where they are particularly relevant, but if you learn about them now, you will already know a lot about the controls described in the following chapters.
The following section describes a particularly important and confusing topic: sizing and positioning properties. Every WPF developer must understand these properties to arrange controls effectively.
Sizing and positioning properties can be very confusing because a control's geometry depends on several different properties, the way in which those properties interact, and even the control's container. For example, the same
Button looks very different when it is placed inside a
StackPanel, or a
The following section describes the most important properties for determining a control's size and position — its alignment properties. The next section then describes some simpler properties that also influence a control's size and position.
Four of the most important properties that determine a control's size are
Width, Height, HorizontalAlignment, and