定义5行
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
在上面5行分别放上5个button,
<Button Grid.Row="0" Grid.Column="0" Margin="20" />
<Button Grid.Row="1" Grid.Column="0" Margin="5 30" />
<Button Grid.Row="2" Grid.Column="0" Margin="5 30 100 0" />
<Button Grid.Row="3" Grid.Column="0" Margin="20" Height="40" Width="100" />
<Button Grid.Row="4" Grid.Column="0" Margin="20" Height="40" Width="100" HorizontalAlignment="Left" />
下面是 button垂直方向对齐或拉伸
<Button Grid.Row="0" Grid.Column="0" Height="50" Width="150" VerticalAlignment="Top" Content="Top顶部对齐" />
<Button Grid.Row="1" Grid.Column="0" Height="50" Width="150" VerticalAlignment="Bottom" Content="Top底部对齐" />
<Button Grid.Row="2" Grid.Column="0" Height="50" Width="150" VerticalAlignment="Center" Content="Top中间对齐" />
<Button Grid.Row="3" Grid.Column="0" Width="150" VerticalAlignment="Stretch" Content="Stretch伸展" />
<Button Grid.Row="4" Grid.Column="0" Height="50" Width="150" VerticalAlignment="Stretch" Content="Stretch伸展并设置高度" />