Silverlight中Grid.RowDefinitions和Grid.Row

定义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伸展并设置高度" />

posted @ 2010-05-10 21:23  回忆过去  阅读(2878)  评论(0编辑  收藏  举报