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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">   <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 O’Reilly online learning.

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