StackPanel 提供一个从左至右或从上至下放置内容的堆栈模型。
   下面的代码直接拷贝到XamlPad中就可以看到效果(XamlPad在什么地方?安装Framework3.0 SDK就可以了)
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  
<Grid>
<StackPanel Orientation="Horizontal" Background="silver" Margin="20">
<Label Margin="5" Content="Username" />
<TextBox
 
Margin="5"
 BorderBrush
="Blue"
 Foreground
="Black"
 Width
="100"/>
<Button Name="test" Width="100" Height="50" Content="Test"/>
<Button  Content="中文也是可以的!"/>

<Label Name="testlabel"  Content="king"/>

 
</StackPanel>
  
</Grid>
</Page>

 Grid 提供一个允许进行行/网格定位的模型:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  
<Grid>
<Button  Width="200" Height="60" VerticalAlignment="Bottom" HorizontalAlignment="Right" 
Margin
="20"   Content="中文也是可以的!"/>
  
</Grid>
</Page>
在网格中,可设置列和行定义,从而可以设置宽和高。可将上述项设置为绝对值(x 像素宽),或者在考虑绝对大小调整之后使用星号表示法来分配剩余的空间。还可以设置一个系数来确定分配该空间的方式。例如:
<Border xmlns="http://schemas.microsoft.com/winfx/avalon/2005">
<Grid LayoutTransform="scale 3" ShowGridLines="true">
<ColumnDefinition Width="30" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
<RowDefinition />
<Button Grid.Column="1" Margin="10">Hello world!</Button>
</Grid>
</Border>
可用 SharedSizeGroup 属性为多个对象指定共享的大小。例如,可使用该属性来指定两个按钮具有相同的宽度(即使它们通常具有不同的大小范围)。例如:
<Border xmlns="http://schemas.microsoft.com/winfx/avalon/2005">
<Grid LayoutTransform="scale 2" ShowGridLines="true" IsSharedSizeScope="true" Height="80">
<ColumnDefinition Width="30" />
<ColumnDefinition Width="Auto" SharedSizeGroup="Buttons" />
<ColumnDefinition Width="Auto" SharedSizeGroup="Buttons" />
<RowDefinition />
<Button Grid.Column="1" Margin="10">OK</Button>
<Button Grid.Column="2" Margin="10">A very long cancel button</Button>
</Grid>
</Border>

WrapPanel 模型是资源管理器窗口的右侧窗格,使您可以处理在当前行已满之后流入新行中的项。例如:
<Border xmlns="http://schemas.microsoft.com/winfx/avalon/2005" 
LayoutTransform="scale 2">
<WrapPanel Background="Silver" Margin="10">
<Button /> <Button /> <Button /> <Button /> <Button /> <Button /> <Button /> <Button 
/> <Button /> <Button /> <Button /> <Button /> <Button /> <Button /> <Button /> 
<Button /> <Button /> <Button /> <Button /> <Button /> <Button /> <Button /> <Button 
/> <Button /> <Button /> <Button /> <Button />
</WrapPanel>
</Border>