Wpf之布局属性!


前言

Wpf之布局属性!


一、布局属性

布局属性,只要是继承了FrameWork基类就可以使用下面的属性

属性作用用法
HorizontalAlignment当水平方向上有额外的空间时,子元素在布局容器中的定位方式,可选值有 Center、Left、Right 或 Stretch 等<Button Content="Button" HorizontalAlignment="Center"/>
VerticalAlignment当垂直方向上有额外的空间时,子元素在布局容器中的定位方式,可选值有 Center、Top、Bottom 或 Stretch 等<Button Content="Button" VerticalAlignment="Top"/>
Margin用于在元素周围添加空间,可分别设置顶部、底部、左边和右边的空间<Button Content="Button" Margin="10,5,10,5"/>
MinWidth 和 MinHeight设置元素的最小尺寸,元素不会小于该尺寸<Button Content="Button" MinWidth="100" MinHeight="50"/>
MaxWidth 和 MaxHeight设置元素的最大尺寸,元素不会大于该尺寸<Button Content="Button" MaxWidth="200" MaxHeight="100"/>
Width 和 Height显式设置元素的尺寸,会覆盖 HorizontalAlignment 和 VerticalAlignment 的 Stretch 设置,但受 Min 和 Max 属性限制<Button Content="Button" Width="150" Height="75"/>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值