Jan 29, 2014

WPF Layouts

Layouts are the mechanism that WPF uses to define how visual items will be displayed on the screen for standard 2D applications. This concept is not new, and if you have used any of the Panel controls in WinForms (FlowLayoutPanel, TableLayoutPanel, etc.), you will not have any trouble understanding the basic layouts in WPF. In their simplest form, the layout classes are nothing more than containers for the other controls in your application and handle the positioning of those controls for you.

These are the five most popular layout panels of WPF:

  •     Grid Panel
  •     Stack Panel
  •     Dock Panel
  •     Wrap Panel
  •     Canvas Panel
 
  • StackPanel - Arranges controls in a line, either horizontally or vertically.
  • WrapPanel - Arranges items in a line until the border is hit, then wraps to the next line.
  • DockPanel - Places controls in five different regions: top, bottom, left, right, or center
  • Canvas - Explicitly position controls based on coordinates.
  • Grid - Defines static columns and rows; like HTML tables.

No comments:

Post a Comment