#6 – WPF Layout

WPF uses a flow-based layout model for positioning controls, rather than a coordinate-based model where the location of each control is specified using exact pixel coordinates.  This is a layout model that is similar to how web pages are laid out using CSS.

The flow-based layout model allows WPF controls to be adjusted to fit the window that they are being rendered in.  A WPF GUI is therefore both size- and resolution-independent.

All WPF controls are hosted in a container.  The main flow-based containers are:

  • DockPanel
  • Grid
  • StackPanel
  • WrapPanel