Chapter 3. Layout and Panels

In this chapter we will cover:

  • Creating a table-like user interface
  • Dynamically sizing grid rows/columns
  • Creating a scrollable user interface
  • Creating a border around panels and elements
  • Placing elements in exact positions
  • Adding/removing elements to a panel dynamically
  • Creating a tabbed user interface
  • Implementing drag-and-drop


Layout is the process of element placement, and how their size and position changes in response to user interactions (such as a window resize). WPF offers a bunch of layout panels that provide different ways to lay out elements. By combining those panels in various ways, complex and adaptive layouts can be created.

The layout process

Layout is a two-step process. First, the layout container ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.