Chapter 5. Layout

Layout in WPF

Before WPF, user interfaces generally consisted of windows with statically placed controls. The programmer set the height and width of a control and placed it at a certain coordinate position on the window or panel, where it stayed. (To be fair, you could also dock controls to edges.)

In WPF, the layout of visual elements is much more dynamic. One of the goals of the WPF layout system is that visual elements should resize and rearrange intelligently when the size of the available window real estate changes. When a window grows or shrinks, the visual elements it contains should automatically change size and position appropriately.

For example, Figure 5-1 shows a window where the buttons in the panel on the left rearrange ...

Get Illustrated WPF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.