您的位置:首页 > 其它

WPD-StackPanel中的控件水平居中

2016-03-14 08:52 274 查看
第一步:设定StackPanel的宽度 Width="100"

第二步:StackPanel中的子控件设定为 HorizontalAlignment="Center"

代码如下:

<StackPanel Orientation="Vertical" Width="100" Background="#FF49E23D" >

<Button Content="Button" Height="25" Name="button2" Width="75" HorizontalAlignment="Center" />

<Button Content="Button" Height="25" Name="button3" Width="75" HorizontalAlignment="Center"/>

<Button Content="Button" Height="25" Name="button4" Width="75" HorizontalAlignment="Center"/>

</StackPanel>

如果大家更好的方法,请与我联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: