定义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伸展并设置高度" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。