Simple Layout with the StackPanel

The StackPanel is one of the simplest layout containers. It simply stacks its children in a single row or column. These elements are arranged based on their order.

For example, consider this page, which contains a stack with one TextBlock and four buttons:

<UserControl x:Class="Layout.SimpleStack"  xmlns=""  xmlns:x="">   <StackPanel Background="White">     <TextBlock Text="A Button Stack"></TextBlock>     <Button Content="Button 1"></Button>     <Button Content="Button 2"></Button>     <Button Content="Button 3"></Button>     <Button Content="Button 4"></Button>   </StackPanel> </UserControl>

Figure 3-3 shows ...

Get Pro Silverlight 5 in VB 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.