"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"
For example, if you have two buttons stacked on top of each other, and the topmost button has a bottom margin of 5, and the bottommost button has a top margin of 5, you have a total of 10 units of space between the two buttons. CHAPTER 4 n LAYOUT 85 Ideally, you??™ll be able to keep different margin settings as consistent as possible and avoid setting distinct values for the different margin sides. For instance, in the StackPanel example it makes sense to use the same margins on the buttons and on the panel itself, as shown here:
This way, the total space between two buttons (the sum of the two button margins) is the same as the total space between the button at the edge of the window (the sum of the button margin and the StackPanel margin). Figure 4-5 shows this more respectable window, and Figure 4-6 shows how the margin settings break down. Figure 4-5. Adding margins between elements Figure 4-6. How margins are combined Minimum,Maximum, and Explicit Sizes Finally, every element includes Height and Width properties that allow you to give it an explicit size.