#22 – Layout Controls

In WPF, the primary model for control layout is flow-based, rather than coordinate-based.  Child controls are added to a layout container control, which manages the location and size of the child controls based on the size and shape of the container.

Here are the main layout controls included in WPF:

  • Canvas – Coordinate-based layout container
  • DockPanel – Controls aligned against one edge of container (e.g. Top/Bottom/Left/Right/Fill)
  • Grid – Controls positioned in rows and columns.  (Default top-level control in empty WPF app)
  • StackPanel – Controls in horizontal or vertical stack
  • UniformGrid – Controls positioned in a grid where all cells have the same size
  • VirtualizingStackPanel – Arrange controls in horizontal or vertical stack.  Controls shown are a visible subset from larger list of items.  Loads controls as needed, i.e. as they become visible.
  • WrapPanel – Controls placed on single line, left-to-right, then wrap to next line if needed.  Can also be top-to-bottom, wrap to next column.

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: