"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"
On the other hand, if you dock a button to the left side of a container, its height is stretched to fit the container, but its width is free to grow as needed. The obvious question is this: How do child elements choose the side where they want to dock? The answer is through an attached property named Dock, which can be set to Left, Right, Top, or Bottom. Every element that??™s placed inside a DockPanel automatically acquires this property. Here??™s an example that puts one button on every side of a DockPanel:
This example also sets the LastChildFill to True, which tells the DockPanel to give the remaining space to the last element. Figure 4-9 shows the result. CHAPTER 4 n LAYOUT 90 Figure 4-9. Docking to every side Clearly, when docking controls, the order is important. In this example, the top and bottom buttons get the full edge of the DockPanel because they??™re docked first. When the left and right buttons are docked next, they fit between these two buttons. If you reversed this order, the left and right buttons would get the full sides, and the top and bottom buttons would become narrower because they??™d be docked between the two side buttons.