开发者

wpf layout-system problem

开发者 https://www.devze.com 2023-01-08 15:06 出处:网络
I\'m not too familiar with wpf layout-system. so i\'m ready to start and understanding that. at the first of road i have a problem with wpf. so according to below markup, i have 4 button which when we

I'm not too familiar with wpf layout-system. so i'm ready to start and understanding that. at the first of road i have a problem with wpf. so according to below markup, i have 4 button which when we run project everything is true.

<Window ... WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight" Name="wMessage" ShowInTaskbar="False" ResizeMode="NoResize" WindowStyle="SingleBorderWindow">
<WrapPanel Orientation="Horizontal">
    <Button Content="Button 1" Margin="10" />
    <Button Content="Button 2" Margin="10" />
    <Button Content="Button 3" Margin="10" />
    <Button Content="Button 4" Margin="10" />
</WrapPanel>

at the right side and bottom of window something appears like a border which i don't know this comes from where!!!

alt text http://www.4freeimagehost.com/uploads/098a981c7a36开发者_如何转开发.png


The problem i that you have given a Margin="10" for every button. By default it takes that single value for all the Four sides. If you don't want the Blank Space for Top and bottom but want them between the buttons then cahnge the XAML to following.

<Button Margin="12,0" Content="Button1"/>
<Button Margin="12,0" Content="Button1"/>
<Button Margin="12,0" Content="Button1"/>
<Button Margin="12,0" Content="Button1"/>

By default if you give only 2 values, first one is taken for both Left and Right and second one is taken for both Top and Bottom.

0

精彩评论

暂无评论...
验证码 换一张
取 消