Measure and Arrange
The WPF was conceived early on as supporting automatic sizing and dynamic layout, so it's not surprising to see this mechanism implemented as a fundamental part of WPF architecture.
Layout occurs in two passes, and begins with the highest level element, in this example, the Page. Every element can have zero or more children. Elements that have multiple children go by the generic name of "panel" and are the primary layout mechanisms. The Panel class has several descendants, including DockPanel, StackPanel, WrapPanel, Grid, UniformGrid, and Canvas, which is the panel that lets you position controls and elements with explicit two-dimensional coordinates.
Layout begins with a call to the virtual MeasureOverride method in the top-level element. (This method is defined in FrameworkElement and it has a rather odd name because it essentially replaces a similar method in the UIElement class MeasureCore.) The parameter to this method is an available size. The MeasureOverride method is responsible for calling the Measure method on all its children (if any), which in turn causes a call to the child's own MeasureOverride method. This is how measuring proceeds from the top of the element tree to the bottom.
The Measure method is responsible for determining what size the element should be. When Measure returns, the parent examines the DesiredSize properties of its children and derives a composite size. For example, a StackPanel with a vertical orientation sums the desired heights of all its children.
The second layout pass begins with a call to virtual ArrangeOverride to the top-level element. The parameter indicates a final size for the element. The parent's job is to arrange all its children within that space with a call to each child's Arrange method, which then calls the child's ArrangeOverride method to ripple through the rest of the layout.
Although panels are commonly used to lay out controls and elements within a page or window, they can also be used inside buttons and other controls. For example, a Button might contain a StackPanel, which then contains text and bitmaps.
As the animations are going on inside PropertySettingsDemo.xaml, the StackPanel is continuously rearranging its children based on their changing sizes.